Open an app with command line arguments

Hello all.

So, I’m trying to convert some Cocoa information into ASOC (as usual)

as per http://www.cocoanetics.com/2011/12/command-line-tools-tutorial-1/ I’d like to open an app with arguments and return a value on closing the app

I thought it may be as simple as argc, argv being reserved words but it appears not.

In AS, it would be relatively simple:

 a.scpt:
    on run argv
      return "hello, " & item 1 of argv & "."
    end run

  % osascript a.scpt world
    hello, world.

But no luck in Xcode :frowning:

If they’re named arguments, you can use NSUserDefaults. But it’s probably easier to use NSProcessInfo:

  set theArgs to current application's NSProcessInfo's processInfo()'s arguments()