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

Please help! Properties don't appear in custom action (VBS)


2 replies to this topic

DeusApprime

DeusApprime
  • Members
  • 73 posts

Posted 31 December 2001 - 09:34

Hi, I have this big problem:
I want to make changes to a file that was installed during Setup. Obviously, the file must first be put in the destination dir (INSTALLDIR). Then I must change it with a custom action in the execution sequence. The action must obviously be deferred. But when it is deferred, I can't see the properties (only 3 props, as documented in MSI library).

I tried to follow the instrcutions in MSI library on how to pass the INSTALLDIR property to the custom action, but I seem to be doing something wrong, because I don't get anything in the CustomActionData property.

Does anyone know how to do this properly?


Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 01 January 2002 - 23:22

First, you need a type 51 custom action, to set the property.  The source of this custom action is the name of the action that you want to set the property for.  This is case sensitive.  The target is a formatted string containing everything that you want to pass to the custom action.  You'll need to seperate the different different pieces of input with a unique character.  

The set property action will have to execute immediately.  Place it in the execute sequence between InstallInitialise and InstallFinalise.

The custom action calling your script should be of type 1030, which is a deferred execution VBScript.  Somewhere within your script, you should have a line similar to:
strProperties = Session.Property("CustomActionData")

I use deferred VBScript custom actions quite extensively, so if that doesn't work, let me know and we'll try and sort it out.


DeusApprime

DeusApprime
  • Members
  • 73 posts

Posted 03 January 2002 - 13:44

Well, problem no.1 is that I can't place the name of the action in the Source field of the type 51 custom action. This is because the action comes from a merge module, and there aren't enough characters in the Source field to hold the name+moduleID.

Problem no.2: What do I do with strProperties? Do I call the Split() function on it? How do I know how to parse it, and get the original property names and values? When I tried typing the value of 'CustomActionData', I got a 0(zero), so I was probably doing sth wrong (it should have contained the value of INSTALLDIR).

More important: What if I have many deferred ca's? Do I have to create a type-51 ca for every one of them? I assume the answer is yes.

Meanwhile, I've solved my problem in a less fashionable way, but it works: I create 3 functions:
'Store': stores properties that I need in a tab-delimited text file in %temp%
'Load':  loads it back into an array
'GlobalProperty': the same as the 'Property' method of the Session object - but it works on the array that I mentioned.

Then, in every deferred ca, I just call "Load" before anything, and instead of calling the property("...") method, I call GlobalProperty("..."). This also means that all my deferred ca's must be in the same .VBS file (so that they will recognize the 3 above functions), but it's ok.

Waiting for your reply on the above questions... An example would be appreciated... Thanks!