Sample Header Ad - 728x90

Troubleshooting: how to see errors from folder action scripts

0 votes
1 answer
134 views
I am trying to set up a "drop" folder: i.e. A watched folder with an associated Apple Script in "Folder Action Scripts". The script is fairly simple. It defines a source link (the watched folder) and a destination path (a folder with the same parent as the watched folder) and runs a python script on the dropped file using the two variables defined as python arguments: on adding folder items to this_folder after receiving added_items set dropFolder to quoted form of POSIX path of "IN/" -- use relative path set destinationFolder to quoted form of POSIX path of "OUT/" -- use relative path try repeat with EachItem in added_items set ItemInfo to info for EachItem if not folder of ItemInfo then set FileExtensionOfItem to name extension of ItemInfo if FileExtensionOfItem is "txt" then set theBaseName to my getBaseNameOf(ItemInfo) set pythonArg1 to theBaseName + "/packageElement" set pythonArg2 to destinationFolder set run_cmd to "python parser.py " + pythonArg1 + " " + pythonArg2 tell application "Terminal" -- pass file name to python using BASH from within this script activate do script run_cmd end tell end if end if end repeat end try end adding folder items to There is some problem - likely minor in the script. Or perhaps there is a file permissions error? I normally would trace my code using some simple technique like display dialog ...; however, *I can not see these dialogues if they are run from the watched folder.* My question is this: **What tools can we use to troubleshoot a folder action script such as this?**
Asked by Parapluie (519 rep)
Mar 17, 2020, 08:38 PM
Last activity: Mar 17, 2020, 09:51 PM