PDA

View Full Version : Chandima?! info from registry...



geoffcox
12-12-2002, 11:47 AM
Chandima,

In your VBScript below - It puts up a message box? What I need is a desktop shortcut and also a Start/Program entry... How do I get these?

To summarise -

1. I install the Java Runtime Environment package. I then run jrew.exe as a Custom Action with an argument (see below).

2. I run the registry search to find where the user has put the JRE files, in particular the jrew.exe file

3. I then create desktop (and Program) shorcuts which will have a path such as d:\jrefiles\bin\jrew.exe

4. this path to jrew.exe must also have an argument such as "-classpath .;[INSTALLDIR]fred.jar;[INSTALLDIR]jane.jar ed.Word.Speech /url=file://[INSTALLDIR]text.htm"

When I use your script I get a message box which has "\bin" in it -presumably it is not getting the path innfo?

Does this make my problem any clearer?!

Cheers

Geoff

-------------------------------------------------------------

from Chandima

Actually submitted Work Order 1-BXV4Q as a feature request today to address this. For this particular instance, try the following:

Go to the Requirements view and create a new Software System Requirement (using wizard) that finds a "Registry entry, that contains a file path". Configure it's "How do you want to look for it?" panel as follows:

Registry Root: HKEY_LOCAL_MACHINE
Registry Key: Software\Javasoft\Java Runtime Environment\1.1
Registry Value: JavaHome

On the last panel give a message like "Test" and complete the wizard. Now change the state of the search check box to the empty box. This means it will perform the search but not stop the setup based on the results. Suppose the name given to this search is JAVAHOME. If so, at runtime, the property JAVAHOME will contain the value in the registry key you looked for. If the key is empty or missing this property will hold an empty value.

Now go to the Shortcut View and create a new "Shortcut to Predefined file". Create a root level folder called "TEST123". Set it's "Directory Identifier" property to TEST123. Set the FileName property to "jrew.exe" and close the dialog.

Now create a VBScript Custom Action with the following code:

Dim JavaHome
JavaHome = Session.Property("JAVAHOME")
Session.Property("TEST123") = JavaHome & "\bin"
MsgBox Session.Property("TEST123")

This (technically) should create a shortcut that points to jrew.exe.

Chandima
12-12-2002, 03:34 PM
Now I see what you are trying to do. This might be a bit more problematic than I thought. The reason is because the searches are all performed right at th beginning of the setup. This is because we use the msi's AppSearch action and this is almost the first thing that get's kicked off.

Do you launch the Java Environment redist at the beginning of the setup? If so we could edit the msi such that it installs before AppSearch happens.

To do this, sequence your custom action (java environment) to launch "after initialization (before first dialog)". Add the registry system search like I mentioned earlier.

Also add a VBScript Custom Action that has the following line (I am assuming the name of your search is JAVAHOME):

MsgBox Session.property("JAVAHOME")

Sequence this action after Install Welcome dialog
Build a CDROM image.

1. Now open the msi in ORCA (search the forums for a URL for this)
2. Go to InstallUISequence Table
3. Locate your Custom Action
4. Set it's "Sequence" value to 20 (so that it launches before AppSearch).
5. Save the msi and close it

Now run the setup. When you press "Next" on the Install Welcome dialog, does the message box show the path to jrew.exe or is it empty?

geoffcox
12-12-2002, 05:22 PM
Chandima,

thanks for your ideas. One problem - so far I have never used ORCA. I have downloaded the software from MS (Windows Installer SDK?)...but have not installed it yet...

One thought - the registry search finds the path to jrew.exe and puts it into a variable (?) which I have called JAVAHOME - that being the name of the AppSearch item....I assume it is not as simple as my being able to access this as [JAVAHOME] ?! If so I could use it in the definition of a shortcut...

Is there any alternative to using ORCA? If not I will install it and see what I can do...

Cheers

Geoff


Originally posted by Chandima
Now I see what you are trying to do. This might be a bit more problematic than I thought. The reason is because the searches are all performed right at th beginning of the setup. This is because we use the msi's AppSearch action and this is almost the first thing that get's kicked off.

Do you launch the Java Environment redist at the beginning of the setup? If so we could edit the msi such that it installs before AppSearch happens.

To do this, sequence your custom action (java environment) to launch "after initialization (before first dialog)". Add the registry system search like I mentioned earlier.

Also add a VBScript Custom Action that has the following line (I am assuming the name of your search is JAVAHOME):

MsgBox Session.property("JAVAHOME")

Sequence this action after Install Welcome dialog
Build a CDROM image.

1. Now open the msi in ORCA (search the forums for a URL for this)
2. Go to InstallUISequence Table
3. Locate your Custom Action
4. Set it's "Sequence" value to 20 (so that it launches before AppSearch).
5. Save the msi and close it

Now run the setup. When you press "Next" on the Install Welcome dialog, does the message box show the path to jrew.exe or is it empty?

geoffcox
12-12-2002, 05:59 PM
Chandima,

looks as if I made a mistake and do not have the Windows Installer SDK ! It seems that the whole package takes up 340MB ! It bit too large for my 56K modem! Do I need all of it? Can I get it on a CD from MS?

any thoughts?

Cheers

Geoff



Originally posted by Chandima
Now I see what you are trying to do. This might be a bit more problematic than I thought. The reason is because the searches are all performed right at th beginning of the setup. This is because we use the msi's AppSearch action and this is almost the first thing that get's kicked off.

Do you launch the Java Environment redist at the beginning of the setup? If so we could edit the msi such that it installs before AppSearch happens.

To do this, sequence your custom action (java environment) to launch "after initialization (before first dialog)". Add the registry system search like I mentioned earlier.

Also add a VBScript Custom Action that has the following line (I am assuming the name of your search is JAVAHOME):

MsgBox Session.property("JAVAHOME")

Sequence this action after Install Welcome dialog
Build a CDROM image.

1. Now open the msi in ORCA (search the forums for a URL for this)
2. Go to InstallUISequence Table
3. Locate your Custom Action
4. Set it's "Sequence" value to 20 (so that it launches before AppSearch).
5. Save the msi and close it

Now run the setup. When you press "Next" on the Install Welcome dialog, does the message box show the path to jrew.exe or is it empty?

geoffcox
12-12-2002, 06:06 PM
Chandima,

I am wrong again! I did have the SDK and can now run ORCA! So will have ago!

Geoff



Originally posted by Chandima
Now I see what you are trying to do. This might be a bit more problematic than I thought. The reason is because the searches are all performed right at th beginning of the setup. This is because we use the msi's AppSearch action and this is almost the first thing that get's kicked off.

Do you launch the Java Environment redist at the beginning of the setup? If so we could edit the msi such that it installs before AppSearch happens.

To do this, sequence your custom action (java environment) to launch "after initialization (before first dialog)". Add the registry system search like I mentioned earlier.

Also add a VBScript Custom Action that has the following line (I am assuming the name of your search is JAVAHOME):

MsgBox Session.property("JAVAHOME")

Sequence this action after Install Welcome dialog
Build a CDROM image.

1. Now open the msi in ORCA (search the forums for a URL for this)
2. Go to InstallUISequence Table
3. Locate your Custom Action
4. Set it's "Sequence" value to 20 (so that it launches before AppSearch).
5. Save the msi and close it

Now run the setup. When you press "Next" on the Install Welcome dialog, does the message box show the path to jrew.exe or is it empty?

geoffcox
12-12-2002, 06:15 PM
Chandima,

couple of questions

1. when you say use ORCA and select InstallUISequence and local Custom Action - which Custom Action do you mean?

2. The original VBScript you gave was

DIM JavaHome
JavaHome = Session.Property("JAVAHOME")
Session.Property("TEST123") = JavaHome & "\bin"
MsgBox Session.Property("TEST123")

What does that become when using the line

MsgBoxx Session.Property("JAVAHOME") ??

Many thanks

Geoff


Originally posted by Chandima
Now I see what you are trying to do. This might be a bit more problematic than I thought. The reason is because the searches are all performed right at th beginning of the setup. This is because we use the msi's AppSearch action and this is almost the first thing that get's kicked off.

Do you launch the Java Environment redist at the beginning of the setup? If so we could edit the msi such that it installs before AppSearch happens.

To do this, sequence your custom action (java environment) to launch "after initialization (before first dialog)". Add the registry system search like I mentioned earlier.

Also add a VBScript Custom Action that has the following line (I am assuming the name of your search is JAVAHOME):

MsgBox Session.property("JAVAHOME")

Sequence this action after Install Welcome dialog
Build a CDROM image.

1. Now open the msi in ORCA (search the forums for a URL for this)
2. Go to InstallUISequence Table
3. Locate your Custom Action
4. Set it's "Sequence" value to 20 (so that it launches before AppSearch).
5. Save the msi and close it

Now run the setup. When you press "Next" on the Install Welcome dialog, does the message box show the path to jrew.exe or is it empty?

Chandima
12-12-2002, 06:51 PM
Actually you can access the value of the variable as [JAVAHOME]. This is a public property (like INSTALLDIR) that can be used similarly. In my last post I asked you to use the following VBScript:

MsgBox Session.Property("JAVAHOME")

Just use this and forget about the one I gave before. This is just a simple script to see whether the registry search actually found the key properly. If it did, I just want to verify that it is stored correctly in the variable named "JAVAHOME".

As you mentioned try creating a shortcut that points straight to [JAVAHOME]bin\jrew.exe and see if it works. My only concern is whether you might get a error 1606 at the beginning. It's worth a try.

If you do run in to this error you can forget about creating the shortcut in Express. Just delete it and use the following VBScript as a Custom Action:

set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
strJavaHome = Session.property("JAVAHOME")

set oShellLink = WshShell.CreateShortcut(strDesktop & "\My Java Shortcut.lnk")
oShellLink.TargetPath = strJavaHome & "\bin\jrew.exe"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Save

This will pretty much use VBScript to create this shortcut. The reason I'm giving you all this information at once is because I'll be on vacation from Monday till the end of the year :).

geoffcox
12-12-2002, 07:01 PM
Chandima,

plenty to think about ! Have a good holiday!

Cheers

Geoff


Originally posted by Chandima
Actually you can access the value of the variable as [JAVAHOME]. This is a public property (like INSTALLDIR) that can be used similarly. In my last post I asked you to use the following VBScript:

MsgBox Session.Property("JAVAHOME")

Just use this and forget about the one I gave before. This is just a simple script to see whether the registry search actually found the key properly. If it did, I just want to verify that it is stored correctly in the variable named "JAVAHOME".

As you mentioned try creating a shortcut that points straight to [JAVAHOME]bin\jrew.exe and see if it works. My only concern is whether you might get a error 1606 at the beginning. It's worth a try.

If you do run in to this error you can forget about creating the shortcut in Express. Just delete it and use the following VBScript as a Custom Action:

set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
strJavaHome = Session.property("JAVAHOME")

set oShellLink = WshShell.CreateShortcut(strDesktop & "\My Java Shortcut.lnk")
oShellLink.TargetPath = strJavaHome & "\bin\jrew.exe"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Save

This will pretty much use VBScript to create this shortcut. The reason I'm giving you all this information at once is because I'll be on vacation from Monday till the end of the year :).

geoffcox
12-13-2002, 11:56 AM
Chandima,

I did indeed get the 1606 error message so have tried your VBScript for creating the shortcut but the script does not get the path info via the JAVAHOME variable...

I have made a very simple project, just adding one file to the installdir and then creating a registry search for Software/JavaSoft/Java Runtime Environment/1.1 (in HKLM). The JRE is already installed on the PC.

Then running the VBScript. However the shortcut path created is "c:\bin\jrew.exe" not "c:\Program Files\JavaSoft\JRE\1.1\bin\jrew.exe" as it would be if the path was (i) being found and (ii) being passed to the VBScript....

I have the VBScript running "after Setup Progress Dialog". This OK? I have tried other positions but still not working...

Could I email you the .ise file? Any other ideas?

Geoff





Originally posted by Chandima
Actually you can access the value of the variable as [JAVAHOME]. This is a public property (like INSTALLDIR) that can be used similarly. In my last post I asked you to use the following VBScript:

MsgBox Session.Property("JAVAHOME")

Just use this and forget about the one I gave before. This is just a simple script to see whether the registry search actually found the key properly. If it did, I just want to verify that it is stored correctly in the variable named "JAVAHOME".

As you mentioned try creating a shortcut that points straight to [JAVAHOME]bin\jrew.exe and see if it works. My only concern is whether you might get a error 1606 at the beginning. It's worth a try.

If you do run in to this error you can forget about creating the shortcut in Express. Just delete it and use the following VBScript as a Custom Action:

set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
strJavaHome = Session.property("JAVAHOME")

set oShellLink = WshShell.CreateShortcut(strDesktop & "\My Java Shortcut.lnk")
oShellLink.TargetPath = strJavaHome & "\bin\jrew.exe"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Save

This will pretty much use VBScript to create this shortcut. The reason I'm giving you all this information at once is because I'll be on vacation from Monday till the end of the year :).

Chandima
12-13-2002, 12:30 PM
OK. Fresh start. I have attached a sample project, vbscript and reg file. See if you can implement your project using it as a template (I tested and verified that this works by the way).

Basically this is what the project does:
1. It installs Regedit.exe to the normal INSTALLDIR
2. It performs a search for a key named "Location" in HKEY_LOCAL_MACHINE\Software\Test. This key contains a folder path. The name of this search is LOCATION (see Requirements View).
3. It has a shortcut that points to [LOCATION]Notepad.exe. At runtime [LOCATION] will resolve to the path found in the registry. I created this shortcut by doing the following:
- Created a new "Shortcut to Pre-defined folder"
- In the resulting dialog I created a root level folder named "TempLoc"
- I changed it's "Directory Identifier" property to LOCATION
- Enetered the "File Name" as Notepad.exe
- Pressed OK (This shows the shortcut target as [LOCATION]Notepad.exe
4. I added a VBScript Custom action after Install Welcome dialog to see what the value of LOCATION is after the search.

What you need to do with the attached files:
1. Unzip the attached zip file
2. Run the reg file. This will create the HKEY_LOCAL_MACHINE\Software\Test key
3. On your machine, create a folder structure like C:\TestExpress\MyLoc and copy Notepad.exe to it.
4. Open the Express project
5. Delete the VBScript Custom action (because it points to a path relative to my machine). Create a new VBScript custom action and make it point at the attached VBScript file. Make it launch after "Install Welcome" dialog
6. Build and Install

This will create a shortcut that points to C:\TestExpress\MyLoc\Notepad.exe even though Notepad.exe was not installed with the setup. Hope this helps!