appArgs under Mac OS

Archives Forums/MacOS X Discussion/appArgs under Mac OS

Me.32(Posted 2010) [#1]
Hi, I have a problem with the coand AppArgs().
If I build a GUI app and set an argument to ist (with the Terminal) it doesnt accept it.
In console-apps it works fine.
has anyone the same problems?

Thanks


Brucey(Posted 2010) [#2]
GUI apps aren't really designed to be started from the terminal.

How are you running the application? With the "open" command?

According to the open man page ("man open"), you can add --args to the command.

For example :
> open myapp.app --args 1 2 3


For a console app, you would do this :
myapp 1 2 3



Hope this helps.


Me.32(Posted 2010) [#3]
no, without open... thanks but with open it doesn't work, too.


Brucey(Posted 2010) [#4]
It works for me with open.
I even tested it just to be sure what happens...

Here is my example :
SuperStrict

Local s:String
For Local args:String = EachIn AppArgs
	s :+ args + " "
Next

Notify s

When run, this will display a message box with all of the app args.

Compiled as GUI app.

Run with no arguments :
open term_test.debug.app

Result of Notify :
/Users/brucey/Documents/programming/Blitz/term_test.debug.app/Contents/MacOS/term_test.debug

(The first argument is always the path to the app itself)

Run with arguments, as per the docs of open :
open term_test.debug.app --args test


Result of Notify :
/Users/brucey/Documents/programming/Blitz/term_test.debug.app/Contents/MacOS/term_test.debug test

Note that "test" is the first actual parameter.

Note also that you cannot Print or DebugLog when running a GUI app from the terminal, because the output does NOT go to the terminal. Which is why I used Notify.

:-)


Me.32(Posted 2010) [#5]
thanks you very much :)
i tested it with --args -lol <- this is a no-go!
but without - its perfect. thank you!