Command Line Arguments

  • Print
Article Index
Command Line Arguments
AutoPlay Media Studio
TrueUpdate
Setup Factory
All Pages

All developer products from Indigo Rose offer a global table named _CommandLineArgs that will hold all command line arguments passed to the executable. Each application can have specific runtime parameters like SFXSOURCE: (AutoPlay Media Studio) or __IRCT: (Setup Factory), however the basic operation is the same for all of them. In this article I am going to show how to parse the command line arguments, and how to look for certain parameters in order to perform specific tasks in AutoPlay Media Studio, Setup Factory and TrueUpdate. Please note that these are only examples, and by no means that you couldn't perform different actions.

General operation

Before you start to try to write your code to react to a certain command line parameter, it is a good idea that you understand what parameters are passed, and what they are. Each application is different, so take the time to include this code in your application, and place it in a location where it gets executed right at the start of your program.

for i, arg in pairs(_CommandLineArgs) do
  Dialog.Message("info", "Command line argument "..i.." = "..arg);
end

This code will show a series of dialogs, one with each command line parameter that the program received. Perform some tests, and call your program on the command line with sample arguments, and see how the _CommandLineArgs table works. This will be a great help when you try to understand the following samples, or attempt to write your own routines for command line arguments parsing.

sample.exe argument1 argument2 "argument with spaces"

Once you understood the basics of the _CommandLineArgs table, we can proceed to the samples for specific applications.



 

Add a comment (For questions, please use the contact form!)

Security code
Refresh

Our Plugins & Examples Feed

  • POP3 Actions plugin released

    A new, free actions plugin was released today. With it, the developer can check POP3...

  • Reminder: Update Serial Number Validation and/or Subscription Validation

    Next week IPInfoDB's API 2.0 will stop working. If you use an older version than...

Subscribe now!

Advertisement