phew Posted October 6, 2007 Share Posted October 6, 2007 (edited) I received the error: $cmdline = StringRegExp($cmdstring, '(.*?) (.*)', 1) ^ERROR Error: Cannot assign values to constants. in my script If ($foundhost = $hostmatch) Then MsgBox(0, "", $cmdstring) $cmdline = StringRegExp($cmdstring, '(.*?) (.*)', 1) $cmdsplit = StringSplit($cmdline, " ") For $i = 0 To UBound($cmdsplit) - 1 Select Case $i = 1 $cmdparam_1 = StringStripWS($cmdsplit[$i], 8) Case $i = 2 $cmdparam_2 = StringStripWS($cmdsplit[$i], 8) Case $i = 3 $cmdparam_3 = StringStripWS($cmdsplit[$i], 8) EndSelect Next EndIf EDIT: while the string $cmdstring = "debug debug ikdkaksometextskdkakjs123" someone can help pls :| Edited October 6, 2007 by phew Link to comment Share on other sites More sharing options...
BrettF Posted October 6, 2007 Share Posted October 6, 2007 $cmdline is already defined. As I hear you ask? Read on: 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. If you change the varible name you will be good to go. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
phew Posted October 6, 2007 Author Share Posted October 6, 2007 $cmdline is already defined. As I hear you ask? Read on:If you change the varible name you will be good to go.aye, thanks, didn't know that $CmdLine is an autoit-constant Link to comment Share on other sites More sharing options...
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