jomic84 Posted February 17, 2017 Posted February 17, 2017 Hi All, I started using AutoIt tool lately since my TestComplete tool is not supporting some features. The issue I face is I'm trying to send a Parameter externally to the .au3 file. When I hard-code the File name its working, but when I try to pass this through a variable(Since it changes regularly), code is not Working. You help is must needed. Below are the Code I used. Hard-Code: Sys.OleObject("WScript.Shell").Exec("cmd /c ""C:\Users\XXXX\Desktop\SSE_Click.exe Parameter1 """) Actual Need: varTest = "This is for Automation" Sys.OleObject("WScript.Shell").Exec("cmd /c ""C:\Users\XXXXX\Desktop\SSE_Click.exe varTest """). When I try this its considering it as a String and Type as varTest. I tried to separate with concatenate operation and adding quotes. But its not working.
Subz Posted February 17, 2017 Posted February 17, 2017 Can you explain further? Your variable should be in the format $varTest = "This is for Automation" you can then use this in your commandline, however is SSE_Click.exe a compiled Au3 Script? Or is this a third party app? Also what is the Sys.OleObject... where is this run from? Why not just use ShellExecute or Run functions?
jomic84 Posted February 20, 2017 Author Posted February 20, 2017 Hi Subz, Thanks for the reply. Yes SSE_Click is Au3 Script. In TestComplete Tool , we need to Initialize the Object before using it. That's the reason I have used Sys.OleObject for Wscript. Also I'm not able to pass the String with the Spaces Ex: "Alarm Plant Siemens" Code I use: Sys.OleObject("WScript.Shell").Exec("cmd /c ""C:\Users\jmichelle\Desktop\SSE_Click.exe Param1 "Alarm Plant Siemens"""") I'm Sending 2 Parameters. I have used the CommandLine in Au3 script also. This throws the error
Subz Posted February 20, 2017 Posted February 20, 2017 Can you try combination of single and double quotes for example: Sys.OleObject("WScript.Shell").Exec('cmd /c "C:\Users\jmichelle\Desktop\SSE_Click.exe" Param1 "Alarm Plant Siemens"')
jomic84 Posted February 20, 2017 Author Posted February 20, 2017 No, its not working. Test-complete Consider Single Quote as a Comments, so the data following Single Quote is considered as the Comments.
Subz Posted February 20, 2017 Posted February 20, 2017 Hopefully this will work, it worked for me just using Wscript.Shell in vbs Sys.OleObject("WScript.Shell").Exec("cmd /k """"C:\Users\jmichelle\Desktop\SSE_Click.exe"" Param1 ""Alarm Plant Siemens""""")
jomic84 Posted February 20, 2017 Author Posted February 20, 2017 Super.... thank you very much... it works....
junkew Posted February 20, 2017 Posted February 20, 2017 What features are you talking about that AutoIt has but testcomplete not. There is also a com object for AutoIt. Maybe easier to do what you want. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
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