passing command line arguments (NSArgumentDomain) to program under Xcode - cocoa

I'd like to be able to pass command line arguments to programs that are run/debugged under Xcode. I want to do this so that I can command-line enable debug modes using Cocoa's NSUserDefaults and NSArgumentDomain.
How to do that?
Thanks!

Xcode 4
Command line arguments can be set in schemes in Xcode 4. In the scheme editing window, the list of possible actions, such as Build, Run and Test are displayed on the left hand side. Select the Run action for the scheme you are setting the command line arguments for, then add the argument(s) in the 'Arguments Passed On Launch' section.
Pre-Xcode 4
In the left-hand sidebar, expand the Executables section, then right-click the executable you want to have arguments and hit Get Info. Go to the Arguments tab - it has two sections you can use:
Arguments, for command-line arguments you want sent to your program
Environment, for variables you want set in the environment before your program launches

Related

How can I get command line arguments in a Qt Installer Framework script?

I am writing a Qt Installer Framework script, and I would like to allow the user to launch the installer with arguments and then apply those arguments in various ways. For example, a switch to auto accept the EULA, a means to directly pass the target directory, a list of the components to be installed, etc.
The syntax to pass arguments to QIFW installer is Key=Value.
You can provide command line argument like below
YouInstaller.exe Arg1=true
Then you can get this value in Component or Controller script as below
var Arg1 = installer.value('Arg1')
installer QML Type
Controller Script

Use VS envirenment-variables as command-line args

I can use envireonment-variables such as $(TargetFileName) in my pre- and post-build-events. What I want to do is apply those variables to the command-line args of an external program (in my case nunit). So whenever my app starts I want to start another one with the file-name of the first as arg.
Is this possible?
When debugging my project the nunit-windows appears but shows an error-message that the given assembly $(OutDir)$(TargetFileName)$(TargetExt) could not be found. I suppose that the variables are only available during build but not during run so it seems I have to hardcode the parameters to the command-line args. Is this true?

Xamarin: How do I pass commandline parameter when debugging?

Using Xamarin 4.2.3(60), I want to debug a .NET app that takes command line args, I have tried setting the projects General parameters , eg, "/p /Users/Tester/Automation", but when I run in the debugger the Mina method string[] args is null? I have also tried setting the "Run With -> Custom Parameters by editing the Default setting the Arguments = "/p /Users/Tester/Automation" and Working dir to "/Users/Tester/Automation", but when I then "Run with" and choose the saved Custom mode, the program still does not appear to have been passed the arguments?
Anyone know how to run the debugger and pass command line args to the program being debugged?
You can add command line arguments via the Parameters field within Project Properties -> Run -> General.
EG:

Is there a way to access the runtime arguments in the post-action script for Xcode?

Basically, what I would like to do is to first set the arguments passed on launch by editing the scheme of current target, then access those arguments in the script, which I use as the post-action script.
I know I could use many build settings variables such as PRODUCT_NAME, but still can't find one to access arguments. If it is not possible, is there a walk-around? One awkward way I am thinking is to output the arguments to a txt file in my main.mm, then read them in my script. Thanks.

VB6 Debugger - Command line arguements

In the VB6 IDE there is a window were you can specify command line arguements (for debugging). If you create a .exe with arguements specified, will they be published with the application? I don't believe they will.
No, they will not. This is just for testing your application if it uses command line arguments. It allows you to specify your command line arguments and step through exactly like if the program was called with those command line arguments.
For example, you normally pass parameters by simply calling your EXE and providing the parameters at the same time. So, if you normally call your program like such
C:\test.exe /test /inet /copy
You would simply set the command-line arguments to
/test /inet /copy
in the VB6 IDE

Resources