Recently Browsing 0 members
No registered users viewing this page.
I am trying to pass multi-file selections from Windows Explorer into the $CmdLine argument parameters array. For example, and these are not the literal program/project names, I can pass three full path file names via both Window's Run dialog and Terminal into the $CmdLine array, i.e, "c:\Dir\Program.exe" "D:\Test\file1.txt" "D:\Test\file2.txt" "D:\Test\file3.txt". When checked in the running program, $CmdLine index  has the correct value of 3, index  is correct with "D:\Test\file1.txt", index  with "D:\Test\file2.txt" and index  with "D:\Test\file3.txt". I get the same correct results in $CmdLine array when I start Program.exe with the same three file parameters using the Windows Terminal.
Also, I have added a HKEY_CLASSES_ROOT\*\shell\command key to the Window's registry. The registry entry is with a "C:\Program.exe" "%1" "$2" "%3" string value to allow for renaming file(s) from Windows Explorer via the right-click menu. With just one parameter placeholder, "%1" in the string value, a selected file will appear in $CmdLine. $CmdLine is 1 and $Cmdline contains the selected full path file name. Unfortunately, when I change the registry string value to include two more passing arguments, "%2" "%3", $CmdLine =3 (as it should since three file path names are passed to Program.exe), $CmdLine contains "D:\Test\file1.txt", but $CmdLine and  are just empty strings.
It appears to me that Windows is not passing the second and third ("%2" and "%3") selected file's to Autoit, but just the first parameter "%1".
Is there some way that I can select more than one file in Window's Explorer and pass the full file paths into the $CmdLine array?
I know that AutoIt has the _WinAPI_GetOpenFileName function, but I would like to select files directly from Windows Explorer to bring into $CmdLine.
File Renaming Application 22.214.171.124.au3 Reg Key.reg
Hello all! I'm trying to make a little script that sends a message over TCP. An example payload would be:
MY_PAYLOAD#<ATTRS><ATTR><NAME>MAILSERVER</NAME><OPERATION>set_value(ServiceStatus)</OPERATION><VALUE><![CDATA["Not Running"]]></VALUE><TIMESTAMP>1349297031</TIMESTAMP></ATTR></ATTRS>Note how the payload contains special characters, and how the CDATA contains a SPACE (i.e. "Not Running")
My compiled AU3 script expects exactly two command line arguments:
1) destination server/port expressed as 127.0.0.1:80
2) the payload I want to send to my server application (which may have multiple ATTRs, this example only has one ATTR)
MyApp.exe 127.0.0.1:80 "MY_PAYLOAD#<ATTRS><ATTR><NAME>MAILSERVER</NAME><OPERATION>set_value(ServiceStatus)</OPERATION><VALUE><![CDATA["Not Running"]]></VALUE><TIMESTAMP>1349297031</TIMESTAMP></ATTR></ATTRS>"
My problems (plural) are with parsing of the second argument:
1) If I don't wrap second argument in double-quotes, then Windows bails out before even launching EXE with "< was unexpected at this time"
2) If I DO wrap second argument in double-quotes, then two problems can arise when my EXE parses the arguments:
aa) The double-quotes are stripped from the CDATA value. ["Running"] is stored in the array as [Running]
bb) If CDATA value DOES have a space, such as ["Not Running"], then I get an extra unwanted $CmdLine because the SPACE between Not and Running is treated as a separator. My second argument is thus split into two separate arguments,  and  instead of being treated as one arg stored in 
cc) Additionally, my script exits because it has an "IF $CmdLine <>2 THEN Exit (1)" to validate the command line args.
I've tried launching the EXE with the second argument wrapped and escaped in a multitude of ways. Double double-quotes, triple double-quotes, single-quotes on the outside with double-quotes inside (i.e. '"ETC"'), starting the second arg with a caret (i.e. ^"ETC") and one of three things happens:
1) "< was unexpected at this time"
2) my CDATA value is stripped of its double-quotes
3) my payload argument gets split at the space in the CDATA value and the script bails out due to the unexpected 3rd argument.
Any ideas? How can I preserve the second argument literally, including all special characters, quotes and spaces?
I tried adding some string manipulation code to grab the 2nd argument from $CmdLineRaw and it works (preserves the "Not Running" with quotes), but my number of arguments is still 3 instead of 2 if there is a space in the CDATA value.
Any assistance would be greatly appreciated!
Is this possible?
I am trying to understand the $CmdLine array. My goal is to run scriptA.exe have it create a variable $varA and then run scriptB.exe and have scriptB.exe output $varA to a Msgbox. It isn't working though, so I am not getting how this works.
This is what I am trying:
$varA = 'Test' Run('d:\(x86)\AutoIt3\AutoIt3.exe "D:\AutoIT Script\CMDLINE\scriptB.au3"') ScriptB -
If $CmdLine = 0 Then MsgBox(64, "Result", "No variable was found.") Else MsgBox(64, "Variable", $CmdLine & $varA) EndIf
If someone can help me understand why this isn't working, I'd appreciate it.