Jump to content

Help With Command Line Args


Recommended Posts

I have seen this before I just for the life of me cannot find it via the search engine, nor the "Advanced Search Engine" using google,

I need to accept certain command line arguments when I run a script (compiled), and then do something based upon what args were supplied.

Just a little snippet or a link to a post with a snippet would be much appreciated.

Laterzzz,

Onoitsu2

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Link to comment
Share on other sites

Edit: Nevermind.. I didnt understand the post.

Deleted

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

I have seen this before I just for the life of me cannot find it via the search engine, nor the "Advanced Search Engine" using google,

I need to accept certain command line arguments when I run a script (compiled), and then do something based upon what args were supplied.

Just a little snippet or a link to a post with a snippet would be much appreciated.

Laterzzz,

Onoitsu2

HI,

$cmdLine[....]

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

$cmdLine[....]

So long,

Mega

I am still clueless, as I can find no documentation on this variable, and still need assistance. Please post a link to another topic with a scriptlet or please post a scriptlet here.

Thanks,

Onoitsu2

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Link to comment
Share on other sites

$cmdline[0] = number of arguments

$cmdline[1] = first argument

$cmdline[n] = nth argument

$cmdlienraw = raw command line

Example:

Call an exe like this

test.exe /test /this

$cmdline[0] = 2

$cmdline[1] = "/test"

$cmdline[2] = "/this"

$cmdlineraw = "/test /this"

--Hope this helps

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

I am still clueless, as I can find no documentation on this variable, and still need assistance. Please post a link to another topic with a scriptlet or please post a scriptlet here.

Thanks,

Onoitsu2

Some people miss the fact that the help file that comes with AutoIT is also the command reference for the language. You already have the basic info from cdkid, but more generally you want to check out the help file anyway. I keep the help file open the whole time I'm working with AutoIT scripts and refer to it constantly.

:think:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 4 years later...

Some people miss the fact that the help file that comes with AutoIT is also the command reference for the language. You already have the basic info from cdkid, but more generally you want to check out the help file anyway. I keep the help file open the whole time I'm working with AutoIT scripts and refer to it constantly.

:mellow:

Just cause I was looking - the help file (after searching for $cmdline) states :

Command Line Parameters

The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script. Note the scriptname is not classed as a parameter; get this information with @ScriptName instead. A parameter that contains spaces must be surrounded by "double quotes". Compiled scripts accept command line parameters in the same way.

$CmdLine[0] is number of parameters

$CmdLine[1] is param 1 (after the script name)

$CmdLine[2] is param 2 etc

...

$CmdLine[$CmdLine[0]] is one way to get the last parameter...

So if your script is run like this:

AutoIt3.exe myscript.au3 param1 "this is another param"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... this is another param

@ScriptName equals... myscript.au3

In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example:

$CmdLineRaw equals... myscript.au3 param1 "this is another param"

If the script was compiled it would have been run like this:

myscript.exe param1 "this is another param"

$CmdLineRaw equals... param1 "this is another param"

Note that $CmdLineRaw just return the parameters.

Note : only 63 parameters can be return by $CmdLine[...], but $CmdLineRaw will always returns the entire command line.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...