This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- InstallShield Without Administrative Privileges
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
04:13 PM
Automation Interface -> ISWiPathVariables
I am trying to update a path variable in the ISM. I am using Perl to create the ISWiPathVariables object however, I am doing something wrong in that I cannot find a method to actually update a path variable - at least one that works.
Note that $isProject->ISWiPathVariable does not work. The method is not found. However, if I try $isPathVariables->ISWiPathVariable it finds the method but I am told that I have an incorrect number of parameters.
The help documentation indicates that this should work with the project object. However, there are no examples in help for this so I am sort of fishing on my own 🙂
Can anyone help me better understand what I need to do to update a path variable? Thanks.
$isProject = Win32::OLE->CreateObject ('ISWiAuto15.ISWiProject', \&OleQuit);
$isPathVariables = Win32::OLE->CreateObject('ISWiAuto15.ISWiPathVariables', \&OleQuit);
$isProject->OpenProject ($path);
$isPathVariables = $isProject->ISWiPathVariables;
my $pathVar = "PATH_TO_GOLD";
$isProject->AddPathVariable($pathVar);
$isProject->ISWiPathVariable ($pathVar, $pathToGold, $testVal, epvtCustom);
Note that $isProject->ISWiPathVariable does not work. The method is not found. However, if I try $isPathVariables->ISWiPathVariable it finds the method but I am told that I have an incorrect number of parameters.
The help documentation indicates that this should work with the project object. However, there are no examples in help for this so I am sort of fishing on my own 🙂
Can anyone help me better understand what I need to do to update a path variable? Thanks.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 27, 2008
02:06 AM
I'm not sure what
The ISWiPathVariables (note the trailing "s") is a collection in the ISWiProject object, not a method. The path variable object is returned from the AddPathVariable method. I have a similar piece of code (but in Ruby):
If you want to retrieve an existing path variable and update it's value, you should probably be doing something like
I assume that you can express this similarly in Perl.
The ISWiPathVariables (note the trailing "s") is a collection in the ISWiProject object, not a method. The path variable object is returned from the AddPathVariable method. I have a similar piece of code (but in Ruby):
@project = WIN32OLE.new(...)
@project.OpenProject(...)
...
variable = @project.AddPathVariable("VARNAME")
variable.Value = "..."
If you want to retrieve an existing path variable and update it's value, you should probably be doing something like
@project.ISWiPathVariables.each do |var|
if var.Name = "VARNAME"
var.Value = "new value"
end
end
I assume that you can express this similarly in Perl.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 27, 2008
01:37 PM
I got the perl syntax figured out. My problem was in how to use perl to 'put' and 'get' values.
Below is my implementation in case anyone is interested:
[code]
##############################################################################
# @name SetPathVariable
#
# @brief Sets the path variable, if not found it creates a new one
#
# @arg1 ISM Project Object
# @arg2 item name
# @arg3 item value
# @returns 1 path variable is updated, 0 failed
#
# @author Dan Lee
#
# @version 1.0
##############################################################################
sub SetPathVariable ($$$)
{
#assign arg to variables - perl will throw exception if not enough args
my ($project, $itemName, $itemValue) = @_;
my $isPathVariables = "";
#backup warning level
my $warnlevel = $^W;
#Disable breaking on errors
$^W = 0;
if (not defined ($project))
{
die "SetPathVariable project not defined";
}
#fetch path variable collection
$isPathVariables = $project->ISWiPathVariables;
if (not defined ($isPathVariables))
{
die "SetPathVariables failed to get PathVariables collection";
}
#fetch single `record` by name
my $var = $isPathVariables->Item($itemName);
if (not defined ($var))
{
#if name is not found then create new name
$project->AddPathVariable($itemName);
$var = $isPathVariables->Item($itemName);
}
#Assign value to current `record`
$var->{Value}=$itemValue;
$^W = $warnlevel;
if ($itemValue ne $var->Value)
{
return 0;
}
return 1;
}
sub main()
{
die ("Usage: $0 $1 $2 \n") if @ARGV != 3;
my $retVal = 0;
my $projectFile = $ARGV[0];
my $pathToCurrent = $ARGV[1];
my $pathToGold = $ARGV[2];
Win32::OLE->Initialize (Win32::OLE::COINIT_MULTITHREADED);
#NOTE: ISQuit is a subroutine that calls CloseProject()
#sub ISQuit {my $object = shift; $object->CloseProject();}
$isProject = Win32::OLE->CreateObject ('ISWiAuto15.ISWiProject', \&ISQuit);
$isProject->OpenProject ($path);
$retVal = SetPathVariable($isProject, "PATH_TO_GOLD", $pathToGold);
if ($retVal == 0)
{
$isProject->CloseProject ();
die "Failed to set path variable for \"PATH_TO_GOLD\" to $pathToGold.";
}
$retVal = SetPathVariable($isProject, "PATH_TO_CURRENT", $pathToCurrent);
if ($retVal == 0)
{
$isProject->CloseProject ();
die "Failed to set path variable for \"PATH_TO_CURRENT\" to $pathToCurrent.";
}
$isProject->SaveProject ();
$isProject->CloseProject();
$^W = $warnLevel;
}
&main();
[/code]
Below is my implementation in case anyone is interested:
[code]
##############################################################################
# @name SetPathVariable
#
# @brief Sets the path variable, if not found it creates a new one
#
# @arg1 ISM Project Object
# @arg2 item name
# @arg3 item value
# @returns 1 path variable is updated, 0 failed
#
# @author Dan Lee
#
# @version 1.0
##############################################################################
sub SetPathVariable ($$$)
{
#assign arg to variables - perl will throw exception if not enough args
my ($project, $itemName, $itemValue) = @_;
my $isPathVariables = "";
#backup warning level
my $warnlevel = $^W;
#Disable breaking on errors
$^W = 0;
if (not defined ($project))
{
die "SetPathVariable project not defined";
}
#fetch path variable collection
$isPathVariables = $project->ISWiPathVariables;
if (not defined ($isPathVariables))
{
die "SetPathVariables failed to get PathVariables collection";
}
#fetch single `record` by name
my $var = $isPathVariables->Item($itemName);
if (not defined ($var))
{
#if name is not found then create new name
$project->AddPathVariable($itemName);
$var = $isPathVariables->Item($itemName);
}
#Assign value to current `record`
$var->{Value}=$itemValue;
$^W = $warnlevel;
if ($itemValue ne $var->Value)
{
return 0;
}
return 1;
}
sub main()
{
die ("Usage: $0
my $retVal = 0;
my $projectFile = $ARGV[0];
my $pathToCurrent = $ARGV[1];
my $pathToGold = $ARGV[2];
Win32::OLE->Initialize (Win32::OLE::COINIT_MULTITHREADED);
#NOTE: ISQuit is a subroutine that calls CloseProject()
#sub ISQuit {my $object = shift; $object->CloseProject();}
$isProject = Win32::OLE->CreateObject ('ISWiAuto15.ISWiProject', \&ISQuit);
$isProject->OpenProject ($path);
$retVal = SetPathVariable($isProject, "PATH_TO_GOLD", $pathToGold);
if ($retVal == 0)
{
$isProject->CloseProject ();
die "Failed to set path variable for \"PATH_TO_GOLD\" to $pathToGold.";
}
$retVal = SetPathVariable($isProject, "PATH_TO_CURRENT", $pathToCurrent);
if ($retVal == 0)
{
$isProject->CloseProject ();
die "Failed to set path variable for \"PATH_TO_CURRENT\" to $pathToCurrent.";
}
$isProject->SaveProject ();
$isProject->CloseProject();
$^W = $warnLevel;
}
&main();
[/code]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 27, 2012
08:59 AM
Hi D.Lee
Do you have a similar implementation for VB Script ?
I receive a similar error whenever i decide to change the value of a variable
Cheers
Srivatsa
Do you have a similar implementation for VB Script ?
I receive a similar error whenever i decide to change the value of a variable
Cheers
Srivatsa
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 27, 2012
02:48 PM
srivatsahg wrote:
Hi D.Lee
Do you have a similar implementation for VB Script ?
I receive a similar error whenever i decide to change the value of a variable
Cheers
Srivatsa
Unfortunately not. I have not revisited this code for some time. 😄
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 09, 2012
01:26 PM
Hi,
here is a snippet I use to update a standard path variable in a vbscript build script. Please note the pluralization for ISWiPathVariables. This was trial and error since the documentation has uses the singular form which didn't work for me.
-Sandra
here is a snippet I use to update a standard path variable in a vbscript build script. Please note the pluralization for ISWiPathVariables. This was trial and error since the documentation has uses the singular form which didn't work for me.
set oProject = CreateObject("ISWiAuto18.ISWiProject")
oProject.OpenProject "myproject.ism", True
set oPathVariables = oProject.ISWiPathVariables
...
oPathVariables("my variable name").Value = "my new value"
-Sandra
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 31, 2012
08:56 AM
Hi,
I am trying to create sample application using Installshield 2009 which should install application without Admin-Rights.For that
In General Information - Require Admin Privileges set to "NO".
ALLUSERS = "1","2"
OS = Windows 7 Professional
User = Standard User(Non-Admin)
After setting above setting, I still getting an error 1925 stating that I do not sufficient privleges.
How do I rectify this issue, please help me out
Thanks & Regards,
Sai
I am trying to create sample application using Installshield 2009 which should install application without Admin-Rights.For that
In General Information - Require Admin Privileges set to "NO".
ALLUSERS = "1","2"
OS = Windows 7 Professional
User = Standard User(Non-Admin)
After setting above setting, I still getting an error 1925 stating that I do not sufficient privleges.
How do I rectify this issue, please help me out
Thanks & Regards,
Sai