Skysnake Posted December 10, 2017 Posted December 10, 2017 (edited) Hi Problem is this myscript -p <zumerkelen> -x something else myscript is my AutoIt compiled CUI. -p <> is first param - fails, see below -x [text] second param, works. When I run this with the param enclosed in <> I get the response The syntax of the command is incorrect. Experimentation indicates that the <> tags are the problem. _ArrayDisplay($CmdLine, "1 Array") MsgBox(16, "1 Raw", $CmdLineRaw) The problem is with the reading of the command line. It fails BEFORE it gets into the variables... I am not dealing with AutoIt, or even my own command line, this is legacy software. It seems that AutoIt "interprets" the <> before loading the command line... I need to be able to read that as text without it being interpreted. The only part I can control is my script, the myscript, which I can change at will. The standard command line functions appear all to interpret params on read. I want those params read raw. If I could just get that as a string it would be fine. Where to look? Skysnake Edited December 10, 2017 by Skysnake Skysnake Why is the snake in the sky?
water Posted December 10, 2017 Posted December 10, 2017 I assume that cmd.exe interprets <> as redirection operators. Can you test using quotes? Quote myscript -i "<myscript>" My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Skysnake Posted December 10, 2017 Author Posted December 10, 2017 Hi Water Ironic that you would be first on the scene. I can test. But problem is that I cannot change the received command line. I receive it from legacy software which includes multiple <> instances... Skysnake Why is the snake in the sky?
water Posted December 10, 2017 Posted December 10, 2017 (edited) Do you really need the brackets? If the parameter contains spaces you could simply use quotes: Quote myscript -i "my script" Edit: Answered by the post above Edited December 10, 2017 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Skysnake Posted December 10, 2017 Author Posted December 10, 2017 Tested Skysnake Why is the snake in the sky?
Skysnake Posted December 10, 2017 Author Posted December 10, 2017 (edited) I do not generate that command line and I cannot change it. All I can do is read it. And the standard AutoIt "command line read" apparently involves interpreting first... Maybe a more specific question --- is that $CmdLineRaw part of the core AutoIt interpreter? Does this problem require developer intervention? See this Quote Command Line Parameters Passing command line parameters to your own executable is achievable in AutoIt. Passed commandline parameters can be viewed by using the constant variables $CmdLine and $CmdLineRaw. Assigning these variables with new data will cause AutoIt to return an error, as these cannot be changed during the script's execution. Note that both variables exist whether commandline parameters are passed or not. From https://www.autoitscript.com/autoit3/docs/intro/running.htm Edited December 10, 2017 by Skysnake Skysnake Why is the snake in the sky?
water Posted December 10, 2017 Posted December 10, 2017 The problem is caused by th way your legacy software calls your compiled script. Compile both main.au3 and test.au3 and run main.exe. ; main.au3 Run("test.exe -i <Test>") ; Test.au3 #include <Array.au3> _Arraydisplay($Cmdline) msgbox(0, "", $Cmdlineraw) You will see that you get the expected results. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted December 10, 2017 Posted December 10, 2017 18 minutes ago, Skysnake said: Maybe a more specific question --- is that $CmdLineRaw part of the core AutoIt interpreter? Does this problem require developer intervention? Yes and No. Yes: $CmdLineRaw is part of AutoIt. No: The error message you see is not generated by AutoIt but by the Windows command line interpreter (see post #2) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Skysnake Posted December 10, 2017 Author Posted December 10, 2017 Skysnake Why is the snake in the sky?
Skysnake Posted December 10, 2017 Author Posted December 10, 2017 (edited) You have given me an idea. I am going to check something. Thank you for your help. Got it Part of the problem is the documentation of the legacy software. The documentation indicates the use of <>, which the actual software does not use... So I was testing for something that does not exist. Replaced the vendor app with my test script and it works like a charm. I was in a corner there, but thank you for a clear head. Edited December 10, 2017 by Skysnake Skysnake Why is the snake in the sky?
water Posted December 10, 2017 Posted December 10, 2017 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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