jomic84

Load Parameter to au3 file from TestComplete Automation Tool

8 posts in this topic

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. 

Share this post


Link to post
Share on other sites



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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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"')

 

Share this post


Link to post
Share on other sites

No, its not working. Test-complete Consider Single Quote as a Comments, so the data following Single Quote is considered as the Comments.

Share this post


Link to post
Share on other sites

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""""")

 

Share this post


Link to post
Share on other sites

Super.... thank you very much... it works....

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now