0
votes

I am developing a Cocoa application using Xamarin.Mac. The application compiles and runs well, however, when I attempt to launch it via AppleScript, the launch always fails due to a timeout error. (The application itself is quite small. It typically launches in less than 2 or 3 seconds)

  • If I double-click /Applications/MyApp.app using the Finder, the application launches fine.

  • If I type $open /Applications/MyApp.app in a bash shell, the application launches fine.

  • When I type $osascript -e 'tell application "MyApp" to activate', the application does not appear to launch, and I get a result of "45:53: execution error: MyApp got an error: AppleEvent timed out. (-1712)"

  • When MyApp.app is running, I can issue the command $osascript -e 'tell application "MyApp" to quit', and the application quits as expected.

  • When I type $osascript -e 'tell application "Dictionary" to activate', the Dictionary application (in /Applications) launches.

-- I'm assuming that there is something wrong with my application that is preventing it from responding to the 'activate' event when it is not running. However, I don't know where to go to debug it. (There are no entries in the console log indicating a problem, and a logging event in the "Main" function doesn't log anything, making me believe that my application isn't being launched)

Any ideas on where I can look to figure out what's going on?

1

1 Answers

0
votes

A shot in the dark: try using the keyword launch instead of activate.