cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBScript in Custom Actions

I am trying to run this very small and simple VBScript, which works fine outside InstallShield:

PROGRAM_NAME = "SMART Board Software"
set ws = WScript.CreateObject("WScript.shell")
currentuser = ws.RegRead("HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\LOGON USER NAME")
reg_location = "HKLM\Software\CEG\Apps\" & PROGRAM_NAME & "\" & PROGRAM_NAME
reg_value= "Installed by " & currentuser & " on " & Date
ws.RegWrite reg_location, reg_value, "REG_SZ"


I am trying to put it in to Custom Actions as "Stored in Custom Actions". Personaly, I don't care when the script will run, as long as it runs at least once during the installation.
No matter what settings I put in Common, it would not execute, and I am sure of that because I tried to put MsgBox in to the script and it never showed up during installation.

Can anyone help?
(4) Replies
WScript object should not be referenced in VBScript custom actions. For explanation, please look up WScript in the forums.

For the task you want to achieve, there are built-in properties available, which can be used in Registry table. For a complete list of properties, please refer to Property Reference.
I am new to Install Shield and VBScripting...
Can you be somewhat more specific?
Are you trying to say that IF I want to continue using Custom Actions all I have to do is change
set ws = WScript.CreateObject("WScript.shell")
to
set ws = CreateObject("WScript.shell")?
Instead of the line:
currentuser = ws.RegRead("HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\LOGON USER NAME")
you have the property [LogonUser] available

To Write the value back into the registry, you have the property [ProductName] which will be equivalent to your PROGRAM_NAME. Use the registry view to enter it.

Using the tables gives you the advantage of being able to uninstall easily and should anything go 'wrong' with the install, rollback will return your system to its previous state.

looeee