1

I'm trying to write an automation Javascript to test my app's AppleScript functionality. I want it to launch my dev build, so I started off like so:

my_app = Application('/Users/Dov/Library/Developer/Xcode/DerivedData/MyApp-efmlzhsvapzuwcfqxjxhhuncpogy/Build/Products/Debug/MyApp.app')

When I run the script, it launches another build in a totally different directory. However, the following AppleScript does launch the intended dev build:

tell application "/Users/Dov/Library/Developer/Xcode/DerivedData/MyApp-efmlzhsvapzuwcfqxjxhhuncpogy/Build/Products/Debug/MyApp.app"
    activate
end tell

Shouldn't these both behave the same way? And how/why would it look for another app with the same Bundle ID? This documentation says my Javascript syntax should work:

Accessing Applications

Applications can be accessed in these ways:

  1. Name

    Application('Mail')

  2. Bundle ID

    Application('com.apple.mail')

  3. Path

    Application('/Applications/Mail.app')

...

foo
  • 3,171
  • 17
  • 18
Dov
  • 15,530
  • 13
  • 76
  • 177
  • 2
    You should always use AppleScript to test your application's scripting interface. A lot of Apple event functionality just doesn't work right, fails, or is completely missing in JXA and Scripting Bridge. AppleScript may suck as a language, but it's the de facto standard and the only supported option that actually speaks Apple events correctly. – foo Jan 21 '15 at 10:57
  • Hmm. What if you make a new String object and set it to the path, **then** set my_app to that string? Just spit-balling here. – CRGreen Jan 22 '15 at 06:29

0 Answers0