AppleScript Action Not Successful On Initial Run Of Macro

The modified Chris Stone AppleScript action below doesn't return the converted text in the RailcarFile_Text variable when executed as part of the macro on its first run. However, it does successfully return the converted text when run immediately afterwards using the "Try Action".

The Railcar_File is open in PDFpenPro and the variable is properly defined. The PDFpenPro OCR is successfully achieved (both times), but the RailcarFile_Text variable is found to be empty on the initial macro run. The RailcarFile_Text does hold the text when the action is executed using the "Try Action" afterwards. It doesn't seem to be a timing issue as I've added delays without different results. Could there be some other reason that the pdftotext would not execute successfully on the initial run of the macro?

Keyboard Maestro Actions.kmactions (13 KB)

kmpOld

Your best bet to debug is to use a tool like Script Debugger 7, and step through the script line by line, observing the results of each line.

SD7 now comes with a 20-day free trial, and then will gracefully downgrade to the free SD7 Lite (which is still much better than Script Editor).

JMichaelTX,

Wow! $99 stopped me from just buying it outright, but I'll check into the free trial and videos on its usage.

Thanks

1 Like

Chris et al,

My apologies! The AppleScript works just fine. It seems it was indeed simply a timing problem. Thanks again for the tip of learning to use Script Debugger.