Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 6

VBScript Example for using ISWiPathVariables

On Error Resume Next

if WScript.arguments.length = 0 then
'WScript.echo "This script requires IS project file"
'WScript.echo "and a version number to be passsed in"
'WScript.echo "Usage: productversiontest.vbs "
end if

If WScript.arguments(1) = 14 then
Set oProject = CreateObject("SAAuto14.ISWiProject")
End if

'Set file location
oProject.OpenProject WScript.arguments(0)

If Err.Number <> 0 Then
'Wscript.echo "Invalid path to InstallShield project file: " & WScript.arguments(0)
End If

Dim oPathVariable
set oPathVariable = CreateObject("SAAuto14.ISWiPathVariables")
set oPathVariable = oProject.ISWiPathVariables

Dim sVariable
set sVariable = CreateObject("SAAuto14.ISWiPathVariable")
set sVariable = oPathVariable.Item(WScript.arguments(2))
sVariable.Value = WScript.arguments(3)


Set sVariable=Nothing
Set oPathVariable=Nothing
Set oProject=Nothing
Labels (1)
0 Kudos
(2) Replies
Level 13

Thanks for posting this rasky74!

At first I was a bit confused by the implementation below, however, what I was missing was the following.

oPathVariable is a collection of all the Path Variables found in the specified project.

sPathVariable is the specific item from that collection.

Even with that bit of confusion your post saved me a bit of time figuring out how to modify a path variable using the automation interface.

DebbieL, if you happen to read this post perhaps you can suggest that this be example added to the help documentation for ISWiPathVariables and ISWiPathVariable (note that the first one is a collection, the second a specific item from that collection). The reason for this is that in looking in the documentation it is not clear that the user has to actually create a collection before modifying one item of that collection.
0 Kudos
Level 17

Thanks, rasky74! And thanks for the suggestion, Dan! An example in the documentation would be helpful. I created IOC-000069203 to log this doc enhancement.

Debbie Landers
Macrovision Corporation
0 Kudos