PDA

View Full Version : VBScript Custom Action fails on Vista



jhogsett
01-05-2007, 09:04 PM
I'm trying to use a VBScript custom action to set ALLUSERS to "1" in order to get an InstallShield 12 Express installer to install for all users on the machine, not just the current user.

My script is one line:

Session.Property("ALLUSERS") = "1"

When I run the installer, I get the following error:

"Error 1720.There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action SetAllUsersOn script error -2147467259, Msi API Error: Property,Name Line 1, Column 1, "

As a test I used part of the sample custom action VBScript in the InstallShield 12 Express help and it fails with the same error:

Session.Property("INSTALLDIR") = Session.Property("INSTALLDIR")

Why is this failing and how do I get it to work?

Is there another method for making All Users the default?

Per project specs I cannot display the Customer Information dialog box.

Thanks

- Jerry

bryanwolf
01-08-2007, 09:59 AM
As kind of a sanity check, you might try running MsgBox "Hello!" just to see if that works?

I tried this in a sample project and it worked successfully.

jhogsett
01-08-2007, 12:27 PM
Bryan, yes that worked. That was the first thing I tried. I can use that API in a MsgBox call to display the current value (an empty string). It complains on setting it.

bryanwolf
01-08-2007, 12:35 PM
Where do you have this custom action sequenced?

jhogsett
01-08-2007, 12:47 PM
Bryan I placed it in "Before File Transfer" which seemed like the safest place to set it and is mentioned in help as the place to set properties before the install.

Other info:
Source Location: Browse File System
Function Name: (blank)
Wait For Action: Yes
Run Once: No
Ignore Exit Code: No
Comment: (blank)
Condition: No Conditions

jhogsett
01-08-2007, 01:09 PM
Just tried again with the below script. I get a message box with an empty string for INSTALLDIR then the above error upon clicking OK.


MsgBox "INSTALLDIR before: " & Session.Property("INSTALLDIR")

Session.Property("INSTALLDIR") = Session.Property("INSTALLDIR")

MsgBox "INSTALLDIR after: " & Session.Property("INSTALLDIR")

MsgBox "ALLUSERS before: " & Session.Property("ALLUSERS")

Session.Property("ALLUSERS") = "1"

MsgBox "ALLUSERS after: " & Session.Property("ALLUSERS")

jhogsett
01-09-2007, 07:43 PM
I just got it to work. What I found is:

1) The custom action must be attached to an event for a dialog box that is enabled in Customize the Setup Appearance/Dialogs. If not, the script fails to run - the Session object appears to be invalid.

2) The event I tried to attach it to, Before File Transfer, also does not display a dialog and therefore it fails when attached to that event.

I attached it to the After Install Welcome dialog event and it works perfectly. I was able to set ALLUSERS to "1" and verify it installed that way on the Vista machine.

I didn't see this restriction in the documentation but I might have missed it.

- Jerry

TsungH
01-13-2007, 04:04 AM
Express Edition IDE hides the details in a MSI installation. If you have not, you will want to read up on Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer (http://www.macrovision.com/company/news/newsletter/tips/install-phase.shtml) by Stefan Krueger (http://www.installsite.org) and MSI Properties and Deferred Execution (http://www.macrovision.com/company/news/newsletter/tips/CustomActionData.shtml) by Robert Dickau.

When custom action is scheduled at Before File Transfer, I believe it's scheduled in Deferred Execute Sequence.

jhogsett
01-16-2007, 12:47 PM
Thanks. Neither article refers directly to "before file transfer".

Where is the correct place to attach a custom action to *set* properties using the Session object?

Why is the Session object only instantiated when a UI dialog is displayed? (The script runs even if a dialog is not displayed, but accessing the object generates an error.)

Given the above how do I force ALLUSERS = "1" in a silent install that displays no UI dialogs?

This seems like a simple thing; I can't believe it's this hard! :-)

- Jerry

TsungH
01-16-2007, 04:45 PM
That's why I said Express Edition IDE hides the details in a MSI installation. Express is targeted for straightforward, simple installations. Hence Express does not provide a whole lot of customizations. You may want to evaluate Professional/Premier Edition and decide if they are right for you.

Session object is available in UI Sequence, and Immediate Execute Squence, but not Deferred Execute Sequence. I do not know on top of my head what Before File Transfer translates to in the final MSI. You will need to use Orca (a free utility from MS) to view the content of MSI to find out.

jhogsett
01-16-2007, 04:58 PM
Thanks for the info.

I may get around to using Orca. Since Express offers custom actions, one would expect them to work. If there are restrictions, it would be nice if they were documented.

If it were up to me I'd have the full version, but it isn't.

- Jerry