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

Fetching a installer property from VB script defer


5 replies to this topic

mayur_bm

mayur_bm
  • Full Members
  • 17 posts

Posted 19 December 2006 - 05:31

Hi all,

I want to fetch a installer property from VB script custom action (deferred type and property is a Public one) which I like to use to configure a xml file. But I am not getting how to do it, please kindly can anybody throw some light on achieving this…………… as my task at standstill because of it……………. sad.gif

Thanks,
Mayur

Edited by mayur_bm, 19 December 2006 - 05:32.


nesesser

nesesser
  • Full Members
  • 62 posts

Posted 19 December 2006 - 08:11

If I correctly understood the question, you should do the following (according to Obtaining Context Information for Deferred Execution Custom Actions)
QUOTE
>To write the value of a property into the installation script for use during the execution of a deferred execution custom action

1. Insert a small custom action into the installation sequence that sets the property of interest to a property having the same name as the deferred execution custom action. For example, if the primary key for the deferred execution custom action is "MyAction" set a property named "MyAction" to the property X which you need to retrieve. You must set the "MyAction" property in the installation sequence before the "MyAction" custom action. Although any type of custom action can set the context data, the simplest method is to use a property assignment custom action (for example Custom Action Type 51).
2. At the time when the installation sequence is processed, the installer will write the value of property X into the execution script as the value of the property CustomActionData.

In your CA use CustomActionData property!

mayur_bm

mayur_bm
  • Full Members
  • 17 posts

Posted 20 December 2006 - 13:55

Iam using below code to fetch an product code from MSI, but script is not working

set activeview=Database
set view = activeview.OpenView("SELECT `Value` FROM `Property` WHERE

`Property`= 'ProductCode'")
view.Execute
Set Rec = view.Fetch
If Not Rec Is Nothing Then
Set FS = CreateObject("Scripting.FileSystemObject")
Set TS = FS.CreateTextFile("C:\Test.txt")
TS.Write Rec.StringData(1)

TS.Close
End If

iam creating a deferred custom action with embedde code mentioned above
but its failing........ sad.gif
please suggest me some changes i need to do.............

Thanks,
mayur

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 21 December 2006 - 10:37

You don't have to use SQL and OpenView to get properties from the current installer session. And the ProductCode is even avalaible in a deferred custom action. So your code would become something like this:
CODE
TheProductCode = Session.Property("ProductCode")
Set FS = CreateObject("Scripting.FileSystemObject")
Set TS = FS.CreateTextFile("C:\Test.txt")
TS.Write TheProductCode
TS.Close


mayur_bm

mayur_bm
  • Full Members
  • 17 posts

Posted 22 December 2006 - 06:40

Thank you very much sir.........
its working so well.................... smile.gif

cheers,
mayur

mayur_bm

mayur_bm
  • Full Members
  • 17 posts

Posted 22 December 2006 - 12:20

thanks a lot to nesesser too.... smile.gif