Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.

Create custom actions with wise macro

Created: 08 Oct 2012 | 1 comment

Hi,

I have an problem and hope you can help me. I create an wise macro to do some work easier and will create 2 custom actions with the macro.

I have 2 wise script exe files which I will execute one of them during installation and the other during uninstallation. My problem is the entry inside the custom action table which looks like that:

Action Type Source Target
"MyCustomActionName" "3137" "WiseCustomCall" "g0"

I have no Idea what is mean with the "g0" entry?
The problem is, that the custom action will be created with the marco but the "executable" and the "Commandline Arguments" fields are empty. When I change some entries manually (After I runs the macro), the Custom Action Type "Run WiseScript From Installation" will be changed to "Call DLL From Installation Function". *confused*

This is an example of my macro:
Set NewRow = WTables.Item("CustomAction").NewWRow   
            NewRow("Action") = "CA_SetRights"
            NewRow("Type") = "3137"
            NewRow("Source") = "WiseCustomCall"
            NewRow("Target") = "g0"            
            
        Set NewRow = WTables.Item("CustomAction").NewWRow   
            NewRow("Action") = "CA_CleanUp"
            NewRow("Type") = "3137"
            NewRow("Source") = "WiseCustomCall"
            NewRow("Target") = "g1"
            
        Set NewRow = WTables.Item("InstallExecuteSequence").NewWRow   
            NewRow("Action") = "CA_SetRights"
            NewRow("Condition") = "0"
            NewRow("Sequence") = "6550"    
            
        Set NewRow = WTables.Item("InstallExecuteSequence").NewWRow   
            NewRow("Action") = "CA_CleanUp"
            NewRow("Condition") = "0"
            NewRow("Sequence") = "6575"                
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "1"        
            NewRow("Type") = "0"            
            NewRow("Text") = "CA_SetRights"    
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "2"        
            NewRow("Type") = "0"            
            NewRow("Text") = "Custom Action Name: CA_SetRights"        
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "3"
            NewRow("Type") = "16385"
            NewRow("Text") = "NOT REMOVE"
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "0"
            NewRow("Type") = "16386"
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "1"
            NewRow("Type") = "0"
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "2"        
            NewRow("Type") = "0"            
            NewRow("Text") = "CA_CleanUp"    
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "3"        
            NewRow("Type") = "0"            
            NewRow("Text") = "Custom Action Name: CA_CleanUp"        
            
        Set NewRow = WTables.Item("WiseSequence").NewWRow   
            NewRow("Table") = "InstallExecuteSequenced"
            NewRow("Sequence") = "6550"
            NewRow("SubSequence") = "4"        
            NewRow("Type") = "16385"            
            NewRow("Text") = "REMOVE~=""ALL"                    
            
        Set NewRow = WTables.Item("WiseStreamFiles").NewWRow   
            NewRow("Name") = "WiseCustomCall"
            NewRow("Path") = ".\CleanUp.exe"
            NewRow("Attributes") = "4"
            
        Set NewRow = WTables.Item("WiseCustomActionDoc").NewWRow   
            NewRow("Action_") = "CA_CleanUp"
            NewRow("Description") = "This custom action will delete the installation folder during the uninstallation process."
            
        Set NewRow = WTables.Item("ActionText").NewWRow   
            NewRow("Action") = "CA_CleanUp"
            NewRow("Description") = "My Custom Action"

Maybe you see my error inside the script and help me to solve my problem?

Many thanks.

pampersbomber
 

Comments 1 CommentJump to latest comment

EdT's picture

WiseCustomCall is a call to a Wise DLL, NOT to wisescript. That is why your code is getting changed. The Wise templates include some predefined custom actions that are embedded in a Wise DLL and this has nothing at all to do with any custom actions written in Wisescript.

A Wisescript custom action is effectively "run exe from installation", if I recall correctly, as the wisescript is compiled into an EXE when it is used to create a custom action.

The reference in the target column to g0 is basically specifying an entry point in the DLL you are calling.

Since your custom action is of type 3137, this resolves to 1 + 64 + 3072.

This is a Type 1 custom action (DLL call)

+64 = Synchronous custom action, ignore exit code

+3072 = (1024+2048) - Queues for execution at scheduled point within script. Executes with no user impersonation. Runs in system context as a deferred custom action.

Basically, you need to get a working MSI with the custom actions defined correctly, before you do any macro scripting. Then look directly at the custom action table in setup editor and note the exact parameters. Using the wrong parameters as you appear to be doing above, is likely to be the reason your results do not meet your expectations.

The SDK help file MSI.CHM has a full explanation of the workings of custom action types and the various attributes associated with the type and the source/target fields.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.