I have the following Applescript that uses PDFpen to OCR a document.
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
The repeat block at the end waits for the document to finish before the rest of the script continues. I cannot seem to replicate this part of the logic in rb-appscript. Any help would be appreciated.
 
                        
I figured this out. Here is the resulting rb-appscript code.