-- The main.scpt file is the entry point for the macOS app on run argv try -- Check if RUN_FROM_LAUNCHD is set as an environment variable. -- We use this env var check to prevent unintentional double-click launches. set runFromLaunchd to system attribute "RUN_FROM_LAUNCHD" if runFromLaunchd is not "true" then display dialog "This app is not designed to be launched by double-clicking. Please install the launchd agent to run it instead." buttons {"OK"} default button "OK" with icon stop return end if -- Always run the run.sh script when the app is launched set qScriptPath to quoted form of POSIX path of (path to resource "run.sh") do shell script qScriptPath return on error errMsg number errNum display dialog "AppleScript error: " & errMsg & " (" & errNum & ")" buttons {"OK"} default button "OK" return end try end run