Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Passing command lines to vbscript


2 replies to this topic

mattw112

mattw112
  • Members
  • 5 posts

Posted 03 October 2002 - 22:18

I'm new to using InstallShield and recently I have been having a problem with one thing.
I want to be able to set permissions on a folder during an installation.  I am using the Admin Studio 3.5 which has a function similar to this called 'lockpermissions' but this is only available on folders that are created during the setup, not on an existing folder (I learned this after a few hours of messing with it trying to get it to work...).
I do have a vbscript that will set permissions on folders that I could run.  The problem is I tried to create a custom action that would run this vbscript, but this vbscript requires you to enter several command lines to tell it which folder, user, permissions, etc.. to set.  I didn't see a place where I could pass command lines to the script in the custom action setup/properties?  So if anyone knows how to do this I would appreciate it.
First let me tell you what I have done to get it to work.  I turned my vbscript into an exe and then created a custom action with a command line.  That works fine.  But I would rather know how to do it through the vbscript if there is a way.  
Also I know I could rewrite the script and set the values manually instead of getting them through passed command lines, however there are thousands of lines of code and this script does more than just what I am using it for so it has several subs, etc... and would get confusing to edit.
Anyway thanks for the help,
Terry

yoavshabtai

yoavshabtai
  • Members
  • 19 posts

Posted 07 October 2002 - 09:24

Hi
The method for doing that is something like this"
Code Sample

function CreateMTSPackage2
   Dim strPackageName, strComponentDir, strComponents, strIdentityType
   Dim strDebug, bPackageUpdated, bPackageExists
   Dim PropArray

   ' Get the installer properties
   PropArray = Split(Session.Property("CustomActionData"), ";")
   strPackageName = PropArray(0)
   strComponentDir = PropArray(1)
   strComponents = PropArray(2)
   strDebug = PropArray(3)
   bPackageUpdated = False
   bPackageExists = False

   Erase PropArray

This is just a fragment from the code but that's the idea.
In your project create a CA named "YourCAName" that will
set a property by the name "YourPropertyName"

Some thing like this:
    nResult = MsiSetPropertyhMSI,"YourPropertyName",szValue);

Set the property before calling the VBS.
Note :
Use "CustomActionData" to get information from a Deferred Execution Custom Actions.
Otherwise you can use
PropArray = Split(Session.Property("YOURPROPERTY"), ";")
or something like this.
I'm sure if you look at the msdn you will find more information.



I hop this will help you.
--Yoav

mattw112

mattw112
  • Members
  • 5 posts

Posted 07 October 2002 - 21:00

Thanks for the reply.

Terry