“No user interaction allowed” When running AppleScript in python

后端 未结 2 1416
闹比i
闹比i 2021-01-19 04:00

I have the applescript which will displays menu list and allow user to select menu items etc. It runs fine by itself. And now I try to run it in python. I get the No user i

2条回答
  •  既然无缘
    2021-01-19 04:04

    My issue was an app with LSBackgroundOnly = YES set attempting to run an AppleScript that displays UI, such as display dialog ...

    Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"

    AppleScript.scpt: execution error: No user interaction allowed. (-1713)

    Using tell application "Finder" ... or etc. works, as shown in the other answer.

    Or, remove the LSBackgroundOnly key to enable UI AppleScripts without telling a different Application.

    LSUIElement presents a similar mode - no dock icon, no menu bar, etc. - but DOES allow UI AppleScripts to be launched.

提交回复
热议问题