Basic Use of Parameter Passing Between Scripts

First post so be gentle with me…

Apologies for this very basic question relating to scripts, but I can’t seem to get parameters passed to a script to be substituted correctly. I am new to SenseTalk and Eggplant scripting.

I have a script containing a line:

Run “RunWin2003R2-32VM”, “CleanNoBAClient”

The script RunWin2003R2-32VM contains this:

params VMsnapshot
Log "Parameter is ", VMsnapshot

However, when I run the 1st script the value of VMsnapshot is not logged.

What am I doing wrong?

Thanks in advance.

The short answer is that you can solve the problem by changing your calling script to this:

Run "RunWin2003R2-32VM"   "CleanNoBAClient"

What’s happening here is that the Run command has a special syntax that’s different than most other commands, in a rather subtle way. Basically, it doesn’t require a comma between the script name and the first parameter to that script. A good way to diagnose a problem with parameters and find out just what’s being passed is to add this command to the called script (or type this in the Do box while debugging):

put the params

When I added this line to a copy of your scripts, it showed:
runwin2003r2_32vm “”,“CleanNoBAClient”

Here, you can see that two parameters are being passed, the first one being empty. Since the Run command doesn’t expect a comma between the script name and the first parameter, the comma is being interpreted as implying that empty first parameter. I can see that this is confusing, so we will consider changing this behavior in the future if it seems clear that the benefits will outweigh the impact of possibly breaking any scripts that rely on this behavior.

Excellent. That’s solved the problem. I knew it would be something simple. :slight_smile:

Many Thanks.