cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a command line parameter through a script?

SOLVED
AndrewCast
Contributor

How to set a command line parameter through a script?

I use a script to install and add a new build of the program.

 

I use
 

 

TestedApps.Add


to add the path to the launcher. I was wondering if there's any way to add a command line parameter too? I want it to launch with the:

 

-shortcuts

 

command, such as it would launch as:

 

"C:\Program Files (x86)\Sample Folder\ Sample Launcher.exe" -shortcuts


But when I try to use 

 

TestedApps.Launcher.Params.ActiveParams.CommandLineParameters = "-qashortcuts"


It launches as 

"C:\Program Files (x86)\Sample Folder\ Sample Launcher.exe -shortcuts"


and complete ignores the -shortcuts command

 

Any idea on how to do this? Preferably from adding it I would like the TestedApps to have -shortcuts defined as a command line parameter but that doesn't seem possible.

 

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: How to set a command line parameter through a script?

Here's the question:

Why use TestedApps at all?  Rather than having to add a TestedApp and then remove it later in the test (or, remember to include it in some sort of cleanup), why not use the WshShell.Exec method to just execute your application at a command line?

https://support.smartbear.com/testcomplete/docs/reference/program-objects/wshshell/index.html


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

3 REPLIES 3
tristaanogre
Community Hero

Re: How to set a command line parameter through a script?

Here's the question:

Why use TestedApps at all?  Rather than having to add a TestedApp and then remove it later in the test (or, remember to include it in some sort of cleanup), why not use the WshShell.Exec method to just execute your application at a command line?

https://support.smartbear.com/testcomplete/docs/reference/program-objects/wshshell/index.html


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

AndrewCast
Contributor

Re: How to set a command line parameter through a script?

I guess I use a launcher for consistiencies sake of consistency.

 

I tend to launch it through TestedApps.Run() but I guess I could work around that. I'll look into the WshShell.Exec method - thanks!

 

There is no way to do this through TestedApps then?

tristaanogre
Community Hero

Re: How to set a command line parameter through a script?

Suffice it to say... rather than changing the commandline parameters after the fact, when you call the "Add" method, add the parameter to the proper parameter of the Add method.

Like so.

function AddingApp(){
    var app = TestedApps.Add('Test.bat','-blah',1,true,'C:\\Temp\\');
TestedApps.Items(app).Run(); }

This places the commandline switch in the appropriate place in the TestedApps object and then all you need to do is run the app./


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors