binarystar Posted March 23, 2008 Posted March 23, 2008 Hello, I'm new to AutoIt and I've become stuck using command line parameters. I've written a small script which I have compiled. I call the executable as follows: thunderbird_send.exe "email.address@domain.com" At the moment, the script has these two lines: MsgBox(64, "Tutorial", $CmdLine[1]) Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to=$CmdLine[1]") The first line causes a small dialog box to display the parameter that was passed in (i.e. email.address@domain.com is displayed in the dialog box). This satisfies me that the parameter is being passed into the executable from the command line successfully. The problem I have arises when the second line is executed: instead of email.address@domain.com being passed to Thunderbird, what happens is that the literal string $CmdLine[1] is passed to Thunderbird. So, for some reason the value within $CmdLine[1] is not being accessed in this case. If I hard code the email address into the line then everything works fine: Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to=email.address@domain.com") I have tried putting quotes around $CmdLine[1] to give: Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to="$CmdLine[1]"") but this doesn't work. In fact I've tried many combinations of double quotes, single quotes, back ticks, percentage signs and nothing seems to work. I would appreciate it if anyone could let me know where I may be going wrong.
Swift Posted March 23, 2008 Posted March 23, 2008 (edited) Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to=" & $CmdLine[1]") Cannot use quotes when running something from the command line, nor any variable. Good day. Finish the quotes, then use & to tell it, something else is coming, then use the Variable. When you use this: Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to=$CmdLine[1]") This is actually whats being sent: Run("C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose to=$CmdLine[1]") its sending: "$CmdLine[1]" NOT $Cmdline[1] Variable. Edited March 23, 2008 by R6V2
binarystar Posted March 23, 2008 Author Posted March 23, 2008 Thanks for your swift and full response. Problem solved.
Swift Posted March 23, 2008 Posted March 23, 2008 (edited) I Is Not Swift! ! R6V2 Rainbow 6 Vegas 2 But your welcome anyways! Edited March 23, 2008 by R6V2
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