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

Custom Action


9 replies to this topic

TAL

TAL
  • Members
  • 77 posts

Posted 19 April 2001 - 07:19

Hi ,
I have a dialog box, in which the client should enter 3 properties, and i need to define a custom action that passes the properties to the exe file, and runs the exe.
any ideas?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 19 April 2001 - 09:04

you can enter the properties in the target field of the custom acton.

TAL

TAL
  • Members
  • 77 posts

Posted 19 April 2001 - 09:32

Thanks,
But what would be the right syntax?
should i separte the parameters with something?
like name of the exe [parameter1][parameter2]
i've tried it, and it is not working...
any suggestions?

Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 19 April 2001 - 11:02

Here's an example row in the CustomAction table from one of our own setup programs. It runs a program I wrote to create network shares as part of an installation.

Action: aCreateDBShare
Type: 3138
Source: bBrShareExe
Target: -c "[DBSHARE]" "[dSharedDatabase]"

This defines a custom action of type 2 (exe file stored in the Binary table). The key of the row in the binary table containing the exe file is "bBrShareExe". The actual program is designed to take a command line like this:

   BrShare.exe -c <sharename> <directorytoshare>
or
   BrShare.exe -d <sharename>

for example:

   BrShare -c Public C:\Public

In this custom action I'm calling it with a command line where the share name and directory name are the values of properties in the installer package called DBSHARE and dSharedDatabase. I put the property names in [] to substitute their values into the command line. The double quotes are just there in case the names contain spaces.

I also have a custom action to remove the share when the product is being uninstalled:

Action: aRemoveDBShare
Type: 3138
Source: bBrShareExe
Target: -d "[DBSHARE]"

Hope this helps. Incidentally if anyone would like a copy of my share creating/deleting program to use in your own installs let me know.


TAL

TAL
  • Members
  • 77 posts

Posted 19 April 2001 - 12:21

Thanks Joe,
I've tried what you suggested, but it still does not work.
My situation is like this - when running the installation i added a dialog box in order to get two parameters from user. so, in the Control table, under property i defined the two parameters - PARAMETER1, and PARAMETER2. after that i've created a custom action with the Target = [PARAMETER1][PARAMETER2], and the exe should get the target_dir also, so i added the target dir as the third parameter. i gave it a Sequence number of 6710 in the InstallExecuteSeuqence.
and still, it does not run the exe.

Help would be appriciated...


Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 19 April 2001 - 15:42

If you're using the standard numbering scheme then sequence number 6710 puts your custom action after InstallFinalize which I think is too late. I would try 6410. I'm not 100% certain but I think that InstallFinalize actually executes the installation script so it's too late to add new items to it after that which is in effect what you're trying to do.

Have you tried generating a log file of the installation and examining that for clues? Use a command line like this:

msiexec -i Whatever.MSI -lie C:\Install.log

or for all the gory details put -l*v instead of -lie


SteveP

SteveP
  • Members
  • 126 posts

Posted 23 April 2001 - 19:03

Certain Custom Actions can be sequenced after Install Finalize.  However, Deferred Custom Actions may only be sequenced between Install Initialize and Install Finalize, as that is the only part of the install that is 'scripted'.

Passing parameters to an EXE file depends greatly on the design of the EXE (how does it parse the command line) and how the EXE is delivered to MSIExec.exe.  Remember that a base type 34 CA requires the name of the EXE as part of the Target field.

Also remember to launch your Custom Action from the same Sequence Thread that you use to display the dialog that gathers the parameters.  Properties set in the InstallUISequence may not be available to Custom Actions launched in the InstallExecuteSequence.

Finally, remember that the Custom Action has to be launched by a control event if you want the dialog containing the edit controls to initiate it.  Probably the easiest way is to associate a DoAction event with the Next pushbutton on the dialog.  

If you want the sequence table to launch the action, then you will want to sequence the action as a deferred CA after the dialog sequence that displays the edit controls.  If you need to complete the CA before the next dialog in the display sequence, I would highly recommend that you use the Next pushbutton and sequence the CA before the NewDialog control event.

If you have additional problems, please feel free to drop me an email.


Gunilla Sundelius

Gunilla Sundelius
  • Members
  • 5 posts

Posted 23 May 2001 - 16:12

This thread was of great help for me, I had pretty much the same problem. Thank you!

Still there is one thing I wonder:
How could I tell whether the user is installing or uninstalling the product?

(I have 2 custom actions and would like to execute the first CA only when the product is installed and the second CA only when the product is uninstalled.)



Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 24 May 2001 - 10:43

Put both custom actions in the execute sequence and use a different condition on each, one that is only true when the product is being installed and another that is only true when the product is being uninstalled. You could use the predefined "Installed" property in your conditions. This is False if the product is not already installed on the machine and True otherwise. You have to be careful though because Installed is also True during maintenance operations like "Repair".

Another possibility is to use conditions based on the action the installer is taking on some component of your product. I prefer this approach. For example, I have a product that installs an Access database that needs to be accessible over the network. I have one CA that shares the directory on the network and another that deletes the share. The conditions I use are:

Action: aCreateShare
Condition: $AccessDB>2
Sequence: 6450

Action: aDeleteShare
Condition: $AccessDB=2
Sequence: 3550

The syntax "$AccessDB" means "the action being taken on the component AccessDB". If this is greater than 2 the component is being installed so create the share. If it's =2 then the component is being removed so delete the share.