Getting proper computer name into simple edit box. - Advanced Installer Community

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!

cecil@coral8.com
Posts: 18
Joined: Mon Oct 27, 2008 11:45 pm

Getting proper computer name into simple edit box.

What I need is the name of the computer the user is installing on.

This is in a simple edit box and the resulting string should be
something similar to:
http://mercury:6789
where "mercury" is a users's computer name.

These are the various combinations that don't work:

http://[|COMPUTERNAMNE]:6789 yields: http://COMPUTERNAME:6789
http://[COMPUTERNAME]:6789 yields: http://[COMPUTERNAME]:6789
http://[ComputerName]:6789 yields: http://[ComputerName]:6789
http://[%ComputerName]:6789 yields: http://[%ComputerName]:6789
http://[%UserDomain]:6789 yields: http://[%UserDomain]:6789
http://[UserDomain]:6789 yields: http://[UserDomain]:6789
http://[%USERDOMAIN]:6789 yields: http://[%USERDOMAIN]:6789
http://[USERDOMAIN]:6789 yields: http://[USERDOMAIN]:6789

I set a property of USERCOMPUTERNAME to [COMPUTERNAME] on the
Install Parameters page, Properties.
This produced similar results.

I am using the Enterprise Project Type.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Getting proper computer name into simple edit box.

Hi,

Please note that the value of an edit box is set by the property of that edit box (when a default value is not used). Therefore, a solution is to set the property of the editbox to the value you want. For this you can use a "Property set with Formatted" custom action under "InstallUISequence" -> "Begin". In the "Property Name" field you can set the name of the edit box property and in the "Formatted Text" field you can set this value:

Code: Select all

http://[ComputerName]:6789
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cecil@coral8.com
Posts: 18
Joined: Mon Oct 27, 2008 11:45 pm

Re: Getting proper computer name into simple edit box.

Thanks for the rapid reply!

I try:
Custom Actions -> InstallUISequence -> Begin
Right Click -> New Custom Action -> Property Set with Formatted
Property Name -> COMPUTERURI
Formatted Text -> http://[ComputerName]:6789

and in the dialogs page I select the edit box.
In the properties pane,
Property -> Default Value = [COMPUTERURI]

.. and the edit box now displays: [COMPUTERURI]
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Getting proper computer name into simple edit box.

Hi,

Please note that the property which contains the value you want ("COMPUTERURI") should be set as the property of the edit box. This is done in the "Property Name" field of the Properties pane. Note that the "Default value" field should be left empty.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cecil@coral8.com
Posts: 18
Joined: Mon Oct 27, 2008 11:45 pm

Re: Getting proper computer name into simple edit box.

Again, thanks for the rapid reply.

Got it! NOW it works.

Setting the property name to COMPUTERURI and leaving the Properly Default Value empty does the trick.

You really need to get a "cookbook" for these tips.

Thanks a lot. :D
mentalmushroom
Posts: 63
Joined: Wed Feb 08, 2012 8:08 am

Re: Getting proper computer name into simple edit box.

I'd like to do the same, but instead of "http://[ComputerName]:6789" I need a registry value. How can I do that? I tried to use the search name, but then property is empty (registry search itself works).
No milk today
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Getting proper computer name into simple edit box.

Hello,

If you followed Cosmin's steps from this thread, in your case you should schedule the "Property set with Formatted" custom action after "AppSearch" standard action instead of "Begin" like my colleague mentioned.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mentalmushroom
Posts: 63
Joined: Wed Feb 08, 2012 8:08 am

Re: Getting proper computer name into simple edit box.

Thanks. That works with edit field. Now have to do the same for combobox: it has a list of values, the needed value is read from the registry (REG_DWORD), the goal is to select the item that matches the registry value. I tried it the same way I did with edit fields and string values, but it seems like there is some conversion problem, so nothing is selected.
No milk today
mentalmushroom
Posts: 63
Joined: Wed Feb 08, 2012 8:08 am

Re: Getting proper computer name into simple edit box.

It seems like the problem is caused by some data conversion error, because when I test search it shows the value with the # prefix while combobox contains only numbers.
No milk today
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Getting proper computer name into simple edit box.

Hello,

Here's the article with registry search return format to help you with the conversion:
http://www.advancedinstaller.com/user-g ... rties.html

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mentalmushroom
Posts: 63
Joined: Wed Feb 08, 2012 8:08 am

Re: Getting proper computer name into simple edit box.

for string entries, the searches property will contain the registry entry's actual value
for binary entries, the searches property will contain the registry entry's value preceded by the "#x" characters (for example "#xValue")
for dword entries, the searches property will contain the registry entry's value preceded by the "#" character (for example "#Value")
That seems to be all what is said about conversion there. Well, I know that, but how can I get rid of that # prefix? Combobox contains numbers (of course, without # prefix). The selected number should be stored in the registry (also without # prefix).
No milk today
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Getting proper computer name into simple edit box.

Hello,

To parse the string you have to develop your own custom action.

Also, here's an article to help you with comboboxes.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”