Helge Posted January 8, 2004 Posted January 8, 2004 (edited) Just wondering.... Is there any kind of command in AutoIt3, that does the same trick as the %1% in AutoIt2? I`ve tried to do the ExpandEnvStrings and then use %1%, but it didn`t work... Maybe there is any other way of doing it...? Edited January 8, 2004 by Helge
scriptkitty Posted January 8, 2004 Posted January 8, 2004 if you want to use command line, AutoIt3 has that one, just improved and put in an array. Command line params =================== The variable $CmdLine contains command line parameters. Note the scriptname is not classed as a parameter, get this information with @ScriptName instead $CmdLine[0]is number of parameters $CmdLine[1] is param 1 (after the script name) $CmdLine[2] is param 2 etcexample1: the compiled autoit script bob.exe This was run like this "Run bob.exe c:\temp1.txt c:\temp2.txt" ; bob.au3 if $CmdLine[0] =0 then exit; this will exit if no command lines are given. msgbox(1,$CmdLine[1],$CmdLine[2]); this would output a msgbox title C:\temp1.txt and info would be c:\temp2.txt ; %1% is $CmdLine[1] ; %2% is $CmdLine[2] ; %3% is $CmdLine[3] ; %4% is $CmdLine[4] ; %5% is $CmdLine[5] ; %6% is $CmdLine[6] ; etc ; $CmdLine[0] = the total amount of command lines given to the program. AutoIt3, the MACGYVER Pocket Knife for computers.
CyberSlug Posted January 8, 2004 Posted January 8, 2004 The unofficial docs seem to be anticipating questions people are having I could make this more clear in the intro section for version 2 users, though... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
spt Posted January 9, 2004 Posted January 9, 2004 heres how its done ;; Example;; AutoItSetOption ( "ExpandEnvStrings", 1) ;; Lets you use variables like in v2 $var = "blahblah" MsgBox(0, "AutoIt", "Here is the variable: %var%") Exit this is really just a VERY basic example i guess. When you use %varname% be sure you put it between "..." cuz i dont know if %varname% will work outside the quotes, just like $varname wont work inside the quotes hope this helped ~~ Safeguarding The Land ~~
scriptkitty Posted January 9, 2004 Posted January 9, 2004 (edited) ;; Example;; AutoItSetOption ( "ExpandEnvStrings", 1) ;; Does not Let you use variables like in v2 $var = "blahblah" MsgBox(0, "AutoIt", "Here is the variable: %var%") ExitExpandEnvStrings is made for enviromentals strings, not variables. like %path% test the code, then use: ;; Example;; AutoItSetOption ( "ExpandEnvStrings", 1);; Lets you use enviromental variables like in v2 MsgBox(0, "AutoIt", "Here is the variable: %path%") if you want a variable, use a $ as in $x or $filename if you want to use a preset Enviromental string, use %path% or one of the AutoIt ones already done like @ScriptName, @ScriptDir, @ScriptFullPath, @WorkingDir, @AutoItVersion, etc. AutoIt3 has some differences, but once you use it, you will see how many advantages Edited January 9, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now