Search for Firefox in the registry is broken...why? - 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!

Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Search for Firefox in the registry is broken...why?

Ok, this works propertly:

Code: Select all

Root: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Mozilla\Mozilla Firefox\2.0.0.1 (es-AR)\Main
Name: Install Directory
Returns C:\Archivos de programa\Mozilla Firefox
But Now I'm going raw.
First...

Code: Select all

Root: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Mozilla\Mozilla Firefox
Name: CurrentVersion
The above returns 2.0.0.1 (es-AR), as named RUTAFF. Then:

Code: Select all

Root: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Mozilla\Mozilla Firefox\[RUTAFF]\Main
Name: Install Directory
Is empty....why?
I'm using AI 4.5
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

You cannot make a search using the result of other search because Windows Installer does not guarantee you that the searches are made in the order that they appear in the "Search" page.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Thanks for the response....

I understand...so no alternatives? :cry:
Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

I was doing something similar in my current project, and for a while the searches were working fine. I guess this was just pure luck, once I tried to add more searches everything got messed up.
As an alternative I now use VB script custom actions to read the registry keys and use the result as property.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Yes, the custom action is my recommendation too. Other way to do that I can't see.

Best Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Phobos wrote:I was doing something similar in my current project, and for a while the searches were working fine. I guess this was just pure luck, once I tried to add more searches everything got messed up.
As an alternative I now use VB script custom actions to read the registry keys and use the result as property.
Do you have a little tutorial about that, VB is not my strong.
Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

Hi Joel,

this VB Script here should do what you are looking for:

Code: Select all

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
  
strKeyPath = "SOFTWARE\Mozilla\Mozilla Firefox"
strValueName = "CurrentVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

MsgBox strValue

strKeyPath = "SOFTWARE\Mozilla\Mozilla Firefox\" & strValue & "\Main"
strValueName = "Install Directory"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

MsgBox strValue
Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Ok...remember I'm a noob, where should I put it? :(
Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

Hi Joel,

put this into a text document and save it as a .vbs file. You can then run it manually on a machine with firefox installed and check if the two message boxes that appear show the correct results.

If this works for you add following line at the end:

Code: Select all

Session.Property("FIREFOXPATH") = strValue
Now you should be able to add your .vbs file as an attached custom action. If I remember correctly you will have to schedule this script before the "AppSearch" standard action.
Then you should be able to use the FIREFOXPATH property within your installation.

When I tried this yesterday at home it did not work, even though I know that I got it working like this in the past.

Gigi, could you please point out if I am missing something?
Thanks!
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The Phobos approach is very good but if you want to use the RUTAFF property in the search you already made my suggestion is to do like this:

In the .vbs script you need only the CurrentVersion so the Phobos script is reducing to something like this: (RUTAFF property keeps the result)

Code: Select all

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Mozilla\Mozilla Firefox"
strValueName = "CurrentVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

Session.Property("RUTAFF") = strValue
After you copy this code to a .vbs file switch to "Custom Actions" page in Advanced Installer and add a "New Attached Custom Action" under "InstallUISequence->Begin". Use following options for the custom action:
1. Function Name: empty
2. Execution Condition: (Not Installed)

To test the result of the search create a "Script in line" custom action under "InstallUISequence->AppSearch" and use this in the "Script Text" field:

Code: Select all

MsgBox Session.Property("RESULT_PROPERTY")
The RESULT_PROPERTY is the property of the search from your first post:
Root: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Mozilla\Mozilla Firefox\[RUTAFF]\Main
Name: Install Directory
Please let me know if you encounter any problems.

Best Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Ok...
this:

Code: Select all

Session.Property("RUTAFF")
has the value of the path...now my question is how to use it as ApplicationPath.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

No, the final result (the path where FireFix is installed) is stored in the RESULT_PROPERTY property. The RUTAFF property keeps the result of the first search (the version of FireFox).

To use the RESULT_PROPERTY as installation path switch to "InstallParameters" page and in the "Application Folder" field type [RESULT_PROPERTY].

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Joel
Posts: 6
Joined: Tue Jan 09, 2007 3:59 am

Oh... I understand now, thanks 8)

One final question...

Seems that VBScripts help a lot to the AdvanceInstaller, do you know any tutorials about how to handle or use vbs?

Thanks :)

Return to “Common Problems”