Sign in to follow this  
Followers 0
Sublime

Command Line Parameters?

7 posts in this topic

How do you add command line parameters to your compiled autoit executable.

I have searched through the forums and could not find anything, I know its out thr sumwhere considering I have seen it done on quite a few scripts around here.

Share this post


Link to post
Share on other sites



autoit -> using autoit -> command line parameters

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hiya all,

Firstly let me start by saying Autoit is flippin brilliant.. i came accross this app a while back and i thought it was good then but the added functions in v3..well..brilliant..keep up the good work.

Any way i didnt want to create a new thread when one already exists on a similar line so..

My simple question is....if i have written a script and compiled it to .exe... if i then drag and drop an ini file ontop of it through explorer, is this passed to the script as a command line parameter.

so lets say i drag and drop test.ini ontop of script.exe would $cmdline read a parameter as 'test.ini' ? :D

Hope that makes sense..lol

Anyway high all and thanks for any help.

Rotahn

Edited cos i can't seem to type

Edited by Rotahn

Share this post


Link to post
Share on other sites

?? would this INI be random or would it be the same as always and to answer your question yes it would but unless you code autoit to deal with an ini and to read it and react it would have to be of similar guide lines regardless of what it is.

If it would be the same ini each time just use hte FileInstall("") function but my impression of what you have said is that this is not the case.

Also why would you want to parse an INI? unless it is to allow for expandability without having to recode and have the script adjust based on the settings specified in the ini.

It would help more if you could explain on the purpose and give a "short" scenario to illaborate on what you are asking.

Share this post


Link to post
Share on other sites

Welcome Rotahn,

so lets say i drag and drop test.ini ontop of script.exe would $cmdline read a parameter as 'test.ini' ? :D

Nothing like proving it to yourself. Compile this code and drop your file on it and see the MsgBoxes display for the incoming Commandline parameters.

MsgBox(0x40000, 'Value of $CMDLINERAW', $CMDLINERAW)

If $CMDLINE[0] Then
    For $i = 1 To $CMDLINE[0]
        MsgBox(0x40000, 'Value of $CMDLINE[' & $i & ']', $CMDLINE[$i])
    Next
EndIf

Exit

You can also use Shift+F8 if you are using Scite4AutoIt3 to test Commandline parameters within the editor, without the need for compiling.

:D

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Nothing like proving it to yourself. Compile this code and drop your file on it and see the MsgBoxes display for the incoming Commandline parameters.

Yeah, Sorry about this post.. i added the code to see if it would work about 5 mins after posting..thought it would be harder than it was. :D Was just trying to bounce off someone as i just couldn't see the wood for the trees at the time.

Thanks for the reply though..just goes to show no matter how stupid the question, people here are happy to help :D

sublime..

unique named ini files are created from another process else where, the contents of which will probably differ quite a bit. It is able to install 30 + apps on a machine unattended but from a list of apps that can change per user / machine.

Rotahn

Edited by Rotahn

Share this post


Link to post
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
Sign in to follow this  
Followers 0