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

Mastering CustomActionData


10 replies to this topic

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 19 April 2002 - 18:04

Hi there,

i need some help with deferred CAs. I'm trying to execute a VBscript located in the SUPPORTDIR and I need the value of INSTALLDIR passed to the script  ??? .

I created an immediate CA to store the value into the CustomActionData property. Querying the CustomActionData in the executing CA and displaying it e.g. in a MsgBox works fine, as long as the vbs code is stored in the CA itself.

Unfortunately my executing script is very large and subject to change so i want it outside the CA, but didn't manage to do so  :( .

Can somebody give me some advise, please.

Thanx
  Stefan

processmate

processmate
  • Members
  • 15 posts

Posted 20 April 2002 - 04:49

Hello there

Could u give more information about what u r doing in the VBScript and about how u went about placing the CAs in the sequence?

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 22 April 2002 - 08:34

Thanx for your interest/help: :D

I put the immediate CA into the "Installation" "Execute" sequence right after "Launch Conditions". The executing deferred CA i put in the same place right after "Start Services" (because in the future the script should only run after a service was installed correctly).

My script works with the WScript object and also does a lot of changes to the IIS metabase.  ???  I use nested functions in there, which i suppose to be the error when the CA holds the complete code (?).

Again my problem is that i didn't manage to call the script, when it's outside the CA. I tried to build an IS script function
that retrieves the CustomActionData and passes it to the VB Script, but haven't got success so far  :(  

Any help would be appreciated...

Cheers
       Stefan

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 22 April 2002 - 10:56

This is a never ending story of complications.

I now know that my problem of the script is also the WScript object, which does not exist when the calling host is MSI. I read in several places that you can instantiate "WScript.XXX" objects very easily, but how can i get the "WScript.Arguments" property working, if the object doesn't exist??  :(  or in other words: how can i pass arguments to the vbs script?

I still cannot believe that it's that difficult to run such a usual task like passing the INSTALLDIR to a vb script  ??? ... and first of all i tried to accomplish a basic MSI... little unkowing me...

Cheers
           Stefan

Karin Popelier

Karin Popelier
  • Members
  • 19 posts

Posted 22 April 2002 - 11:08

Hi Stefan,

You can store your VBScript in the binary table. You can do this via the Custom Action Wizard. On the Action Type screen you select "Stored in the Binary table". On the Action Parameters you browse to your vbscript on your computer. That should do the thing.
The immediate (CA Type 51) should be ok after LaunchConditions and the deferred CA after StartServices should be ok too.

Gr.,

Karin

Karin Popelier

Karin Popelier
  • Members
  • 19 posts

Posted 22 April 2002 - 11:22

To pass data (INSTALLDIR) to your deferred custom action (your VBScript) you should need to add a CA type 51 to pass the parameters.
The source is the name of your deferred CA, the target contains all the properties you wish to pass to the deferred action. I thought you did that in the immediate action you mentioned.

Type    : 51
Source : MyVBCA -> name of the CA which runs your VBScript
Target :[INSTALLDIR];[ANOTHERDIR]


In your VBScript  you read the the property "CustomActionData". If you passed more than one parameter (delimited with ;) you should split the string into an array.

ex.

MyProperties = Session.Property("CustomActionData")
arrMyProperties = Split(MyProperties, ";")
InstallDir = arrMyProperties(0)
AnotherDir = arrMyProperties(1)

I never reference WScript.

This works fine for me.

Gr.,

Karin

hteichert

hteichert
  • Members
  • 158 posts

Posted 22 April 2002 - 12:03

In MSI you haven't got a chance to transfer arguments via WScript.Arguments to a VBScript. You have to use the method Session.Property.

In your special case - using a deferred CA - it's a two step way: you need two CAs, one immediate to transfer the arguments to CustomActionData and the real one.

A good description how to do it can be found at Installshield Knowledgebase Q104413

Good Luck!
h.teichert-ott

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 22 April 2002 - 12:09

> MyProperties = Session.Property("CustomActionData")
> arrMyProperties = Split(MyProperties, ";")
> InstallDir = arrMyProperties(0)
> AnotherDir = arrMyProperties(1)
> I never reference WScript.
> This works fine for me.
>Gr.,
>Karin

Hi Karin !
thanx for your help... Jesus, i'm so confused from fiddling around with this stuff, that i almost forgot the code above.  :p

I used it in my deferred CA to test the retrieval of CustomActionData, but never thought of putting it into my vbs script. Of course this does the trick !

Cheers
        Stefan

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 22 April 2002 - 12:15

Quote (hteichert @ April 22 2002)

A good description how to do it can be found at Installshield Knowledgebase Q104413

Good Luck!


Thanx for you help as well!
I simply was too confused to use what i already knew (in fact right from the article you mentioned above  ??? ).

Cheers
   Stefan



ABhatnagar

ABhatnagar
  • Members
  • 5 posts

Posted 07 November 2003 - 05:31

So how do you split out the properties using MsiGetProperty?

ABhatnagar

ABhatnagar
  • Members
  • 5 posts

Posted 07 November 2003 - 15:30

Well? Does anyone know how to use MsiGetProperty to split out multiple properties passed to it by "CustomActionData". This can easily be done using VB by splitting the session.property but the same thing does not exist in C++.

Any thoughts, anyone?