We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

serganch
Posts: 4
Joined: Mon Dec 25, 2006 3:02 pm

UI Custom actions - what do they look like?

Hello, all

I'm evaluating the latest release and trying to play with UI Custom Actions. The problem is that I don't understand what object model I can use within the script body (which can be either JavaScript or VBScript as the help states).

What runtime the inline or attached scripts are able to use? I tried to make sort of "Hello World" in a message box upon pressing a button. Since I didn't find any reference on writing UI custom action scripts, the only idea that came to my mind was using Windows Script Host (Wscript.Echo "Hello World!").
When I press the button on the installer it finishes execution with the dying screen.

Did I miss something in the help? Could you please point me on the information about the object model available?

Thanks.

Best regards,
Sergey.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

UI Custom Actions are used by the Dialog Editor and are executed by control events. For more details about custom actions please see:
http://www.advancedinstaller.com/user-g ... -page.html
Since I didn't find any reference on writing UI custom action scripts, the only idea that came to my mind was using Windows Script Host (Wscript.Echo "Hello World!").
When I press the button on the installer it finishes execution with the dying screen.
MSDN states:
The installer runs script custom actions directly and does not use the Windows Script Host. The WScript object cannot be used inside a script custom action because this object is provided by the Windows Script Host.
For more details please see:
http://msdn.microsoft.com/library/defau ... cripts.asp

To display a message box will running a custom action you can use this code:

Code: Select all

MsgBox "Hello World!!!"
Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
serganch
Posts: 4
Joined: Mon Dec 25, 2006 3:02 pm

Cool, :)
Thank you.

I would like to ask another question.

Can I populate controls like combo box with dynamic data using custom actions?

I want my installer to install a web application. If the computer has multiple IP addresses I would like the user to be able to select one from the list in a custom dialog. The application then would be accessed remotly using the selected IP address. I can get the list of available IP addresses in a DLL. Is it possible to pass the list to a control in the dialog?
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
Can I populate controls like combo box with dynamic data using custom actions?
Yes this can be done. There is a post about how to populate a combobox from a script please see:
http://www.advancedinstaller.com/forums ... ight=combo

The approach is similar for a DLL custom action. The SQLCmd is identical but to execute it you need to use MsiDatabaseOpenView, MsiViewExecute, MsiViewClose functions. For more details about how to use those functions please see:
http://msdn2.microsoft.com/en-us/library/aa368250.aspx

Hope this helps.

Best Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
serganch
Posts: 4
Joined: Mon Dec 25, 2006 3:02 pm

Thank you, Gigi.

This is very helpful.

Would you also tell me please, can this be done from inside a .NET custom action? I didn't find a way of obtaining the current install session using the Installer class.

Best regards,
Sergey
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
Would you also tell me please, can this be done from inside a .NET custom action?
My suggestion was to use a C++ DLL. Here is an example of how create such DLL:
http://www.advancedinstaller.com/user-g ... n-dll.html

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
serganch
Posts: 4
Joined: Mon Dec 25, 2006 3:02 pm

OK. Thank you very much :)

Best regards,
Sergey

Return to “Common Problems”