如何将此Applescript转换为rb appscript?

如何将此Applescript转换为rb appscript?,applescript,rb-appscript,Applescript,Rb Appscript,我有以下使用PDFpen对文档进行OCR的Applescript tell application "PDFpenPro" open theFile as alias tell document 1 ocr repeat while performing ocr delay 1 end repeat delay 1 close with saving end tell

我有以下使用PDFpen对文档进行OCR的Applescript

tell application "PDFpenPro"
    open theFile as alias
    tell document 1
        ocr

        repeat while performing ocr
            delay 1
        end repeat
        delay 1
        close with saving
    end tell
end tell

最后的repeat块等待文档完成,然后脚本的其余部分继续。我似乎无法在rb appscript中复制这部分逻辑。任何帮助都将不胜感激

我知道了。下面是生成的rb appscript代码

    doc = @app.open MacTypes::Alias.path(file)
    doc.ocr

    while doc.performing_ocr.get
      sleep 1
    end
    doc.close(:saving => :yes)