PDA

View Full Version : Correct Version Detection



AXXESS
09-17-2005, 07:11 PM
IR guys, wondering what the most common issue you find users have if they are having difficulties building patches.

I have built successful patches for projects that I have only 2 versions of (i.e., 1.0.0.0 and 1.0.0.1), but it seems when I attempt to build a patch and include three versions, the patch either a) cant locate the software, or b) tells me that I have the latest version installed when I only have 1.0.0.0. I am looking at a registry key, specifically, and even when it indicates 1.0.0.0 it tells me that the 1.0.0.2 is installed. When this happens, I am launching the patch file from the same directory that the AutoPlay files to be updated are installed in...

Being fairly new at VP, I'm sure that I am missing something. I know that the selected key files can have a huge impact. I have selected key files that are unique to each version. Autoplay.cdd seems to be a good one. The MD5 and CRC values confirm this.

Also, when building a full history patch, how does this work between three versions? For instance, if the user has 1.0.0.1 installed, do they receive all the files needed to get to 1.0.0.2 from 1.0.0.0? I'm thinking this is the case... However, going from 1.0.0.0 to 1.0.0.1 is about 29mb, from 1.0.0.1 to 1.0.0.2 is about 2.4mb, so I'm thinking that incremental patches may be the way to go based on the installed version...

AND... (:)).... is there a best practice to use in TU2 to have the proper incremental patch applied?

Also, an "faq" section for VP2 may be a good idea to include on the support site... currently only version 1 is there.

Corey
09-17-2005, 07:23 PM
This was the FAQ for 2.0 here:
http://visualpatch.com/site/visual-patch-white-papers.php

We figured anyone with more specific questions would ask here. But anyhow what sort of stuff would you like to see added?

AXXESS
09-17-2005, 07:34 PM
Kinda like the one here:

knowledgebase (http://support.indigorose.com/?_a=knowledgebase)

Not the pre-sales stuff, but an in-depth faq section based on inquires of customers through direct support requests, etc.

Anyway, any thoughts on the ??s ? So far VP2 is looking great, and I'm sure I have overlooked something... :)

Corey
09-17-2005, 07:49 PM
OK, I think that will happen at some point, as things move along more stuff will be added to the support site. The dev guys will be back in on Monday, I'm sure they'll have some answers. :)

Lorne
09-19-2005, 11:33 AM
I am looking at a registry key, specifically, and even when it indicates 1.0.0.0 it tells me that the 1.0.0.2 is installed. When this happens, I am launching the patch file from the same directory that the AutoPlay files to be updated are installed in...The default scripted behavior is to check for the key file (or files) in the local folder before checking for version information in the registry. This is to allow the user to override the Registry check, for example if they have more than one version installed, or if the information in their Registry is no longer accurate because they messed it up. :)


Being fairly new at VP, I'm sure that I am missing something.Nothing more than the default order in which the version detection methods are applied in.

Move the patch file out of that directory, and it will see the version in the Registry. If you want, you can disable the local folder check, or make it so the Registry check happens first, by simply rearranging the On Startup script a little bit.


Also, when building a full history patch, how does this work between three versions? For instance, if the user has 1.0.0.1 installed, do they receive all the files needed to get to 1.0.0.2 from 1.0.0.0? I'm thinking this is the case... However, going from 1.0.0.0 to 1.0.0.1 is about 29mb, from 1.0.0.1 to 1.0.0.2 is about 2.4mb, so I'm thinking that incremental patches may be the way to go based on the installed version...Yes, definitely. In most cases it's enough to offer one or two incremental patches, for the previous two releases say, and then offer a full-history patch for the other users. (See "Patching Strategies" on page 34 of the user's guide for a more detailed explanation.)


AND... (:)).... is there a best practice to use in TU2 to have the proper incremental patch applied?It's pretty straightforward. I'd recommend using the Registry key approach to determine the version, as you're doing now. Keep the information about which patch to download for a given version in the server script, obviously, so you can change it without affecting the TrueUpdate client.

You can save a lot of bandwidth by taking advantage of TU2 -- it essentially nullifies one of the main disadvantages of the incremental patch strategy, which is that it can be more complicated for the user. But with TU2 making the decisions automatically, a user never has to figure out which file they need to download for the version they have.

AXXESS
09-19-2005, 12:17 PM
The odd thing is, is that I was able to successfully build a patch going from 1.0.0.0 to 1.0.0.1 and 1.0.0.1 to 1.0.0.2, but not the full history patch.

Testing the full history patch indicates that the software cannot be found, even though I have not changed the script from my initial builds. The registry key is still in place, but it is not seeing it. I have moved the patch file in and out of the folder, no difference. I have changed the detection order. No difference.

I meant I must be missing something, because it did work before, and now it does not. :huh I have 1.0.0.0 clearly in the specific registry key HKEY_LOCAL_MACHINE\\SOFTWARE\\MYPRODUCT\\Data - and for some reason it doesn't see it. Though it did before...



--------------------------------------------------------------
-- Check for administrative privileges
--------------------------------------------------------------

-- Make sure that the user has administrative privileges on the system.
-- (g_IsUserAdmin is defined in _Global_Functions.lua)
if not g_IsUserAdmin() then
if not _SilentPatch then
local Title = SessionVar.Expand("%WindowTitle%");
local Message = SessionVar.Expand(VisualPatch.GetLocalizedString("MSG_SYSREQ_ADMIN"));
local DlgResult = Dialog.Message(Title, Message, MB_OKCANCEL, MB_ICONEXCLAMATION);
if DlgResult == IDCANCEL then
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
else
-- Since it is a silent patch, fail
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
end

--------------------------------------------------------------
-- Locate installed version
--------------------------------------------------------------

-- Define a global variable that will indicate the name
-- of the installed version on the user's system. A nil value
-- indicates that an installed version has not been found.
g_InstalledVersion = nil;

-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
-- Remove the following block comment to enable this script

if not g_InstalledVersion then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", _SourceFolder);
end
end


-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT");
local ValueName = "Data";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end

-- Location method: File search
-- Search the user's system for a file that is known to
-- exist in the software's application folder.
if not g_InstalledVersion then
local TargetFileName = "autorun.exe";
local tbFolders = {};
tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\My Product");
tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%\\My Product Inc.");
tbFolders[3] = SessionVar.Expand("%ProgramFilesFolder%");
-- Insert other folders here...

local CheckFixedDrives = true;
local CheckNetworkDrives = false;

-- (g_FindApplicationOnSystem is defined in _Global_Functions.lua)
g_InstalledVersion = g_FindApplicationOnSystem("%AppFolder%", TargetFileName, tbFolders, CheckFixedDrives, CheckNetworkDrives);
end


--------------------------------------------------------------
-- Ensure that installed software is not running
--------------------------------------------------------------

-- If we located an out-of-date version, make sure the installed
-- software is not running.
-- Remove the following block comment to enable this script

if g_InstalledVersion then
local Filename = SessionVar.Expand("autorun.cdd");
local ProgramName = SessionVar.Expand("My Product");
-- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)
local ProgramIsClosed = g_EnsureProgramIsClosed(Filename, ProgramName);
if not ProgramIsClosed then
Application.Exit(EXIT_REASON_PROGRAM_IS_OPEN);
end
end


--------------------------------------------------------------
-- Set session variables
--------------------------------------------------------------

-- Set session variables that will be used in the log file
-- and in the user interface.
if g_InstalledVersion then
SessionVar.Set("%InstalledVersion%", g_InstalledVersion);
SessionVar.Set("%TargetVersion%", VisualPatch.GetTargetVersion());
end

--------------------------------------------------------------
-- Log result
--------------------------------------------------------------

-- Make a log file entry with the result.
if g_InstalledVersion then
local LogMsg = SessionVar.Expand("Success\tLocated installed version %InstalledVersion%: %AppFolder%\r\n");
VisualPatch.WriteToLogFile(LogMsg);
else
local LogMsg = SessionVar.Expand("Error\tCould not locate software on system\r\n");
VisualPatch.WriteToLogFile(LogMsg);
end

--------------------------------------------------------------
-- Select start screen
--------------------------------------------------------------

-- Decide which "Before Patching" screen to show.
if g_InstalledVersion then
if g_InstalledVersion == VisualPatch.GetTargetVersion() then
-- The target version was found
Screen.SetStartScreen("Software is Current");
else
-- An out-of-date version was found
Screen.SetStartScreen("Ready to Patch");
end
else
-- No version was found
Screen.SetStartScreen("Cannot Locate Software");
end

Lorne
09-19-2005, 03:02 PM
What does the log indicate?

Which version of the files do you actually have installed?

AXXESS
09-19-2005, 07:45 PM
When I am attmpting to apply the history patch to bring the installed version up to 1.0.0.2, I have 1.0.0.0 installed.

Here is the pertinent log info:



[09/19/2005 20:30:07] Success Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
[09/19/2005 20:30:07] Notice Patch engine version: 2.0.1.0
[09/19/2005 20:30:07] Notice Product: MY PRODUCT
[09/19/2005 20:30:07] Success Language set: Primary = 9, Secondary = 1
[09/19/2005 20:30:07] Success Include script: _Global_Functions.lua
[09/19/2005 20:30:07] Notice Start project event: Global Functions
[09/19/2005 20:30:07] Success Run project event: Global Functions
[09/19/2005 20:30:07] Notice Start project event: On Startup
[09/19/2005 20:30:07] Error Script: On Startup, Line 49 (1605)
[09/19/2005 20:30:07] Error Script: On Startup, Line 86 (1002)
[09/19/2005 20:31:17] Error Could not locate software on system
[09/19/2005 20:31:17] Success Run project event: On Startup
[09/19/2005 20:31:17] Success Display screen: Cannot Locate Software
[09/19/2005 20:31:18] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG1.JPG
[09/19/2005 20:31:18] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG2.JPG
[09/19/2005 20:31:18] Notice Exit patch process (Return code: 1210)

Line 49 is this one:


local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);

Line 86 is this one:


-- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)

I see that Return Code 1210 was indicated. The Help file indicates that the %AppFolder% was not successfully located or defined. Something wrong with the OnStartup action.... ?

csd214
09-19-2005, 10:24 PM
I have only created one single VP20 project so I’m a real newbie to VP. The interesting point with this thread is the three versions issue and the Registry read method; exactly like MY project. I haven’t noticed any problem at all, but “the wizard did the entire job” (almost) so I don’t remember much of the challenges!

AXXESS, your script generates the error codes
1605 "Could not get the specified value's data."
1002 "The specified path was not found."

What values do you have in SubKey and ValueName? Could it be that simple that you have forgotten the double backslashes in SubKey?

I would suggest to add VisualPatch.WriteToLogFile() to test the values (please forgive me; I’m new to VP20…)

Lorne
09-19-2005, 10:50 PM
That's a good guess. Adding some temporary actions to output those values before line 49 would be a good idea.

AXXESS
09-20-2005, 09:06 AM
OK, just testing this out, I ran the 1.0.0.1 incremental patch, works fine. So I am attempting to apply the full history patch to go from 1.0.0.1 to 1.0.0.2.

Added the VisualPatch.WriteToLogFile() actions here:


-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
local ValueName = "Data";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
VisualPatch.WriteToLogFile("Stated Variables are: "..FolderPath.."t\r\n", true);
patch = VisualPatch.GetTargetVersion();
VisualPatch.WriteToLogFile("Patching to: "..patch.."t\r\n", true);

g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end

And here is the resulting log:


[09/20/2005 09:52:21] Success Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
[09/20/2005 09:52:21] Notice Patch engine version: 2.0.1.0
[09/20/2005 09:52:21] Notice Product: MY PRODUCT
[09/20/2005 09:52:21] Success Language set: Primary = 9, Secondary = 1
[09/20/2005 09:52:21] Success Include script: _Global_Functions.lua
[09/20/2005 09:52:21] Notice Start project event: Global Functions
[09/20/2005 09:52:21] Success Run project event: Global Functions
[09/20/2005 09:52:21] Notice Start project event: On Startup
[09/20/2005 09:52:21] Stated Variables are: 1.0.0.1t
[09/20/2005 09:52:21] Patching to: 1.0.0.2t
[09/20/2005 09:52:21] Error Script: On Startup, Line 86 (1002)
[09/20/2005 09:52:26] Error Could not locate software on system
[09/20/2005 09:52:26] Success Run project event: On Startup
[09/20/2005 09:52:26] Success Display screen: Cannot Locate Software
[09/20/2005 09:53:13] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG1.JPG
[09/20/2005 09:53:13] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG2.JPG
[09/20/2005 09:53:13] Notice Exit patch process (Return code: 1210)

Lorne
09-20-2005, 09:30 AM
OK, just testing this out, I ran the 1.0.0.1 incremental patch, works fine. So I am attempting to apply the full history patch to go from 1.0.0.1 to 1.0.0.2.

Added the VisualPatch.WriteToLogFile() actions here:


-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
local ValueName = "Data";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
VisualPatch.WriteToLogFile("Stated Variables are: "..FolderPath.."t\r\n", true);
patch = VisualPatch.GetTargetVersion();
VisualPatch.WriteToLogFile("Patching to: "..patch.."t\r\n", true);

g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end

And here is the resulting log:


[09/20/2005 09:52:21] Success Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
[09/20/2005 09:52:21] Notice Patch engine version: 2.0.1.0
[09/20/2005 09:52:21] Notice Product: MY PRODUCT
[09/20/2005 09:52:21] Success Language set: Primary = 9, Secondary = 1
[09/20/2005 09:52:21] Success Include script: _Global_Functions.lua
[09/20/2005 09:52:21] Notice Start project event: Global Functions
[09/20/2005 09:52:21] Success Run project event: Global Functions
[09/20/2005 09:52:21] Notice Start project event: On Startup
[09/20/2005 09:52:21] Stated Variables are: 1.0.0.1t
[09/20/2005 09:52:21] Patching to: 1.0.0.2t
[09/20/2005 09:52:21] Error Script: On Startup, Line 86 (1002)
[09/20/2005 09:52:26] Error Could not locate software on system
[09/20/2005 09:52:26] Success Run project event: On Startup
[09/20/2005 09:52:26] Success Display screen: Cannot Locate Software
[09/20/2005 09:53:13] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG1.JPG
[09/20/2005 09:53:13] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG2.JPG
[09/20/2005 09:53:13] Notice Exit patch process (Return code: 1210)


According to the log, your FolderPath variable contains "1.0.0.1"...which doesn't sound like a valid folder path to me. :)

Are you sure there isn't a mistake in your Registry actions? It looks like you're overwriting the install folder value in the Registry with the current version.

Note that the default script in Visual Patch wants to read your software's location from the Registry. It will use the key files and MD5s and such to determine the version. (This is actually taken care of by the VisualPatch.CheckFolderVersion action.)

You can script a different version checking behavior if you want, e.g. just read the installed version directly from the Registry...although that won't be as foolproof as checking the key files etc.

AXXESS
09-20-2005, 09:43 AM
According to the log, your FolderPath variable contains "1.0.0.1"...which doesn't sound like a valid folder path to me.

Right. This script was untouched from the provided OnStartup Script...other than changing the MainKey type and the ValueName... Isn't the following supposed to return a version number? The version number is stored in the SubKey...


local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
local ValueName = "Data";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);

Lorne
09-20-2005, 09:45 AM
Right. This script was untouched from the provided OnStartup Script...other than changing the MainKey type and the ValueName... Isn't the following supposed to return a version number?


local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
local ValueName = "Data";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
No, it's supposed to return the path to the folder where your software was installed, which should be stored in the Registry for this version detection method to work.

AXXESS
09-20-2005, 12:13 PM
So I should have had Setup Factory specifically write the %AppFolder% to the registry?

If that is the case, then I am wondering why the incremental patches do work... :huh

Currently I have SUF writing the version to HKEY_LOCAL_MACHINE\\MYPRODUCT\\DATA ....

Lorne
09-20-2005, 02:04 PM
So I should have had Setup Factory specifically write the %AppFolder% to the registry?Yeah. That is what the wizard asks you for:

http://www.indigorose.com/forums/attachment.php?attachmentid=2408&stc=1

:)

AXXESS
09-20-2005, 02:46 PM
So I should have had Setup Factory specifically write the %AppFolder% to the registry?

Maybe I should open a ticket on this. My ?? was, must I have **Setup Factory** write this value on my initial setup?

That screenshot is from VP2, not SUF... :)

**Prepares to leave PC frustrated for a while..... easy on me... like I said before... I'm NEW at VP2.... thx :)**

AXXESS
09-20-2005, 10:29 PM
From the Visual Patch help file:


Most applications store the application folder path in the Registry when it is installed. These settings are used to configure the Registry location that this value can be read from.

How about the ones that we built with SUF?

From SUF7 help:


%AppFolder%
The default application directory for your installation. This variable's value may change during the install, for example, through the Select Install Folder screen.


I assume this needs to be manually configured in SUF..... do we need to just write %AppFolder% from SUF to the registry? If so, what is the syntax, and can it be added to the User Guide(s) that this must be configured in SUF7 for VP2 to work properly?

csd214
09-20-2005, 10:58 PM
I’m a bit confused. When your VP run-time executes, it has to know where the installed version is stored. The preferred method is to use the registry method, meaning that the registry already has an entry for the app location (whether the installation is done with SUF or not).

So, the answer is obvious. Setup Factory has to write the actual value of %AppFolder% to the registry.

Typically I have something like this in On Post Install area in SUF70:

local sSubKey = "Software\\My Company\\My Product";
local bKeyExist = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, );
if not bKeyExist then
Registry.CreateKey(HKEY_LOCAL_MACHINE, sSubKey);
end
Registry.SetValue(HKEY_LOCAL_MACHINE, sSubKey, "Location", SessionVar.Expand("%AppFolder%"), REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE, sSubKey, "Version", SessionVar.Expand("%ProductVer%"), REG_SZ);

Have I misunderstood something?

Lorne
09-21-2005, 12:20 AM
Have I misunderstood something?Nope, csd213, you've hit the nail squarely on the head. That is exactly what you should do.

AXXESS, VP2 technically doesn't require such a registry key per se. The wizard offers the Registry detection method precisely because storing the installation folder path in the Registry is a very common practice. Visual Patch is just saying "ok, I need to locate the application folder...did your installer store that info in the Registry? And if so...where?"

AXXESS
09-21-2005, 07:09 AM
Registry.SetValue(HKEY_LOCAL_MACHINE, sSubKey, "Location", SessionVar.Expand("%AppFolder%"), REG_SZ);

Thanks.... that was what I was asking! :)

I guess I misunderstood, because the initial patches I made were run on apps that did not have these actions run with SUF... however, the software was found immediately.

NOW I know for future installs. Thanks. :yes

AXXESS
09-21-2005, 02:24 PM
Ok, I have this set up on Post Install in SUF:



local sSubKey = "SOFTWARE\\MYPRODUCT";
local bKeyExist = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "");
if not bKeyExist then
Registry.CreateKey(HKEY_LOCAL_MACHINE, sSubKey);
end
Registry.SetValue(HKEY_LOCAL_MACHINE, sSubKey, "Location", SessionVar.Expand("%AppFolder%"), REG_SZ);

And it shows up properly in the registry. Here is the OnStartup in VP:



-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
local ValueName = "Location";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end



WHY is it still not finding it....???? I have used dialog boxes to trace that it is retrieving the key (it is)... but still the dreaded "Software Not Found" dialog rears its ugly head. Tearing my hair out here...

Lorne
09-21-2005, 03:16 PM
What does the log indicate?

Did you make any changes to the default Visual Patch project? Is your patch making any changes to the registry, for instance?

AXXESS
09-21-2005, 07:57 PM
Log:


[09/21/2005 20:47:08] Success Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
[09/21/2005 20:47:08] Notice Patch engine version: 2.0.1.0
[09/21/2005 20:47:08] Notice Product: MY PRODUCT
[09/21/2005 20:47:08] Success Language set: Primary = 9, Secondary = 1
[09/21/2005 20:47:08] Success Include script: _Global_Functions.lua
[09/21/2005 20:47:08] Notice Start project event: Global Functions
[09/21/2005 20:47:08] Success Run project event: Global Functions
[09/21/2005 20:47:08] Notice Start project event: On Startup
[09/21/2005 20:47:08] Error Script: On Startup, Line 86 (1002)
[09/21/2005 20:47:12] Error Could not locate software on system
[09/21/2005 20:47:12] Success Run project event: On Startup
[09/21/2005 20:47:12] Success Display screen: Cannot Locate Software
[09/21/2005 20:47:14] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG1.JPG
[09/21/2005 20:47:14] Success Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRI MG2.JPG
[09/21/2005 20:47:14] Notice Exit patch process (Return code: 1210)


No other modifications to the provided OnStartup script. No other registry actions. Tried to write to the log file like this again:


VisualPatch.WriteToLogFile("FolderPath is: "..FolderPath.."t\r\n", true);

but error message results that it cannot be concatenated as it is a nil value.

csd214, are you running the stock OnStartup script in VP2, or did you need to modify it to make this work?

csd214
09-22-2005, 01:33 AM
It’s shocking how much I have forgotten. I worked with this VP project 3 months ago...

I wondered why you used the SessionVar.Expand in
local SubKey = SessionVar.Expand(“SOFTWARE\\MYPRODUCT\\”);
There is no session variable to expand. But I have the same line; probably inserted by the wizard. The result is OK, of course, so never mind.

The only difference is that I don’t have the trailing backslashes
local SubKey = SessionVar.Expand("Software\\<MyCompany>\\<MyProduct>");
but that’s OK; the trailing backslash doesn’t matter.

You still have an error in line 86 (1002 "The specified path was not found.") What exactly is “line 86”? Is it
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);

Do you really have the registry key “HKLM\SOFTWARE\MYPRODUCT”? “MYPRODUCT” isn’t a variable but the exact name of your product.

As far as I recall:
If you have 3 versions in your VP build; version 1, 2 and 3 (in the proper order); and version 4 is the installed version, VP will tell “%ProductName% could not be located on your system. Re-install %ProductName% and then run this patch again.” (The screen “Cannot Locate Software”).

That’s why I added

if not g_InstalledVersion then
ValueName = "EXEVer"; -- EXEver is MY value
sRegistryVer = Registry.GetValue(MainKey, SubKey, ValueName);
SessionVar.Set("%RegistryVer%", sRegistryVer);
end
and

--------------------------------------------------------------
-- Select start screen
--------------------------------------------------------------

-- Decide which "Before Patching" screen to show.
if g_InstalledVersion then
if g_InstalledVersion == VisualPatch.GetTargetVersion() then
-- The target version was found
Screen.SetStartScreen("Software is Current");
else
-- An out-of-date version was found
Screen.SetStartScreen("Ready to Patch");
end
else
-- No version was found (g_InstalledVersion is false)
if sRegistryVer > VisualPatch.GetTargetVersion() then
-- the name of the target (newest) version in the patch. This is the version that is being patched to.
-- a newer version is installed
Screen.SetStartScreen("Software is Newer");
else
Screen.SetStartScreen("Cannot Locate Software"); -- default
end
end
(I have added a ’Static Text’ screen named ’Software is Newer’).

That’s the only modifications I have done in the On Startup paragraph. First of all you have to get rid of your Error message. I suggest you test the values used in ‘line 86’ before you execute that line.

Corey
09-22-2005, 01:40 AM
It’s shocking how much I have forgotten.

Hee hee. I know the feeling. It only takes a month or two of not using a given tool to have me scratching my head sometimes. :)

AXXESS
09-22-2005, 07:31 AM
I wondered why you used the SessionVar.Expand

Just left the default stuff in... :)

Now I have an error code on the following TWO lines:


line 38: local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);

line 86: local ProgramName = SessionVar.Expand("My Product");




Do you really have the registry key “HKLM\SOFTWARE\MYPRODUCT”?

Well, the project name I am working on is not "MYPRODUCT", but the name has been changed to protect the innocent. :) The key does exist in this format with the actual product name, yes.

Thinking I will be spending another day trying to get this to work. :(

Thanks for the input.

csd214
09-22-2005, 08:08 AM
but the name has been changed to protect the innocent
I thought so; just wanted to eliminate a possible misunderstanding.

SessionVar.Expand(“SOFTWARE\\MYPRODUCT\\”); yes, I have an identical code line (inserted by the wizard)

Your error on line 38: There must be something wrong with MainKey, SubKey or ValueName (test the stored values).

I really don’t understand the error on line 86. What’s wrong with this action? [Lorne? Steven Carr?]

I have identical lines:

Line 52: local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
(Paragraph "-- Locate installed version")

Line 112: local ProgramName = SessionVar.Expand("MyExclusiveProduct");
(Paragraph "-- Ensure that installed software is not running")

BTW, it’s nice to have a “VP20 refreshing sequence”.

Lorne
09-22-2005, 08:45 AM
Add this to the start of your script:

Debug.ShowWindow();
Debug.SetTraceMode();

...and then tell us what the actual lines that generate the errors are.

AXXESS
09-22-2005, 03:12 PM
The key files must have been the issue!

I kept the .cdd files only as key files and experimented by dropping a 1.0.0.0 version of the cdd file into the program directory. The patch found it and correctly identified the program version by the key file! I also did the same with the 1.0.0.1 version and the 1.0.0.2 versions of the cdd, and it identified them also. :)

Something I found to be important is to "force install" the cdd and autoplay.exe files on version 1.0.0.2, as they didnt automatically get replaced, and the old (1.0.0.0) behaviors were evident. Created a new patch with force install, and all is good. :)

Thanks to everyone for your input... :yes :yes :yes

Adam
09-22-2005, 03:34 PM
This was an especially hard case to debug because in some cases it is difficult to pinpoint where the error is. For example in this one it appeared as though the registry read was not correct but in the end it was working and the problem was after this point with the key file detection.

Glad we got this one fixed.

Adam Kapilik