|
#1
|
||||
|
||||
|
Here's my code:
-- 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\\YORKFURNSRVGD\\"); 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 ============== The registry value for the installed app is located at: HKEY_LOCAL_MACHINE > SOFTWARE > YORKFURNSRVGD The value name for where the app is located is under: "Location" The program is installed at: C:\ProgramFiles\York Furnace Service Guide ============== Does anyone know why the patch can't find the application via the registry? Thanks, Brian |
|
#2
|
||||
|
||||
|
I would enable logging and see what the log says.
Assuming the Location value exists inside HKLM\SOFTWARE\YORKFURNSRVGD and there is no typo in that name ......in other words, assuming the value is being read from the Registry just fine... ...then it's most likely just that the key files at that path don't match the key files in any of the versions your project knows about. In other words, the VisualPatch.CheckFolderVersion() function is validating the files found at the FolderPath location, using the key files designated in your project to identify the version that is installed. If the key files don't match, then no valid patchable version has been found.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#3
|
||||
|
||||
|
Quote:
Program Files ...unless you specifically changed it after you installed Windows. I'd check to make sure your Location value in the registry actually contains the right path.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#4
|
||||
|
||||
|
Thanks for the help Lorne. My log is below. Maybe you can figure something out:
[01/31/2007 13:34:54] Success Patch started: C:\Documents and Settings\ny000637\Desktop\YORKFURNSRVGD.exe [01/31/2007 13:34:54] Notice Patch engine version: 2.0.4.0 [01/31/2007 13:34:54] Notice Product: York Furnace Service Guide [01/31/2007 13:34:54] Success Language set: Primary = 9, Secondary = 1 [01/31/2007 13:34:54] Success Include script: _Global_Functions.lua [01/31/2007 13:34:54] Notice Start project event: Global Functions [01/31/2007 13:34:54] Success Run project event: Global Functions [01/31/2007 13:34:54] Notice Start project event: On Startup [01/31/2007 13:34:55] Error Script: On Startup, [86]: File.Find(Folder,TargetFileName,true,false,nil,g_c bFcnFindApplicationCallback); (1002) [01/31/2007 13:35:21] Error Could not locate software on system [01/31/2007 13:35:21] Success Run project event: On Startup [01/31/2007 13:35:21] Success Display screen: Cannot Locate Software [01/31/2007 13:35:22] Success Delete image file: C:\DOCUME~1\ny000637\LOCALS~1\Temp\_ir_vp2_temp_0\ IRIMG1.BMP [01/31/2007 13:35:22] Success Delete image file: C:\DOCUME~1\ny000637\LOCALS~1\Temp\_ir_vp2_temp_0\ IRIMG2.BMP [01/31/2007 13:35:22] Notice Exit patch process (Return code: 1210) |
|
#5
|
||||
|
||||
|
Go to Project > Settings > Advanced tab, and change the "Include action details" setting from "Errors" to "Extended Errors" to get as much info as possible in the log.
You could also insert some GetLastError actions to get more specific information on the error.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#6
|
||||
|
||||
|
I already requested the extended errors and that's what I got.
What about the line below? Does it mean that it found the Folder, but not the TargetFileName? Error Script: On Startup, [86]: File.Find(Folder,TargetFileName,true,false,nil,g_c bFcnFindApplicationCallback); |
|
#7
|
||||
|
||||
|
Quote:
Which means that the path being supplied doesn't exist. I think you should check the Registry value as I suggested above.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#8
|
||||
|
||||
|
According to the registry, the app is located in:
C:\Program Files\York Furnace Service Guide I went through windows explorer and the app is located at: C:\Program Files\York Furnace Service Guide I just cannot figure this out...I compared this to another app that I have & the formats are exactly alike. I know this has just got to be something small that I'm missing... |
|
#9
|
||||
|
||||
|
Try adding some dialog boxes to the script to see what the values of Folder and TargetFileName are immediately before the File.Find action.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#10
|
||||
|
||||
|
How exactly do I do that?
|
|
#11
|
||||
|
||||
|
Use Dialog.Message() actions. Search for "Debugging Your Scripts" in the help index.
__________________
--[[ Indigo Rose Software Developer ]] |
|
#12
|
||||
|
||||
|
The only thing that I can figure out is that "AppFolder" has a "nil" value even after it checks the registry.
|
|
#13
|
||||
|
||||
|
Can you post the entire On Startup script?
Put it between [_CODE_] and [_/CODE_] tags to preserve formatting (remove the underscores). Like this: Code:
-- this is inside a code block
__________________
--[[ Indigo Rose Software Developer ]] |
|
#14
|
||||
|
||||
|
Code:
--------------------------------------------------------------
-- 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: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\YORKFURNSRVGD\\");
local ValueName = "Location";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
Dialog.Message("Temporary Debug Message:" , "bob" .. AppFolder);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
Dialog.Message("Temporary Debug Message:" , "bob" .. AppFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
if not g_InstalledVersion then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", _SourceFolder);
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 = "YorkFurnace.exe";
local tbFolders = {};
tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\York Furnace Service Guide");
tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%\\Johnson Controls Unitary Products");
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("MyProgram.exe");
local ProgramName = SessionVar.Expand("York Furnace Service Guide");
-- (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
|
|
#15
|
||||
|
||||
|
Ah, there is no variable named AppFolder in your script; %AppFolder% is a session variable, which is kind of like a patch-specific environment variable of sorts. You need to use a SessionVar.Expand() action to get the value of those; a Lua script variable isn't created for the session variables automatically.
Try changing the highlighted lines like so: Code:
-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = "SOFTWARE\\YORKFURNSRVGD";
local ValueName = "Location";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
Dialog.Message("Temporary Debug Message:" , "FolderPath = \""..FolderPath.."\"");
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
Dialog.Message("Temporary Debug Message:" , "%AppFolder% = \"" .. SessionVar.Expand("%AppFolder%").."\"");
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
__________________
--[[ Indigo Rose Software Developer ]] Last edited by Lorne; 01-31-2007 at 03:13 PM. |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| App Paths registry key being created? | DanCooperstock | Setup Factory 7.0 Discussion | 0 | 12-29-2004 09:58 PM |
| System trap app & Internet calls | Lee_Benson | AutoPlay Media Studio 5.0 | 11 | 11-23-2003 08:15 PM |
| Registry Features | Dwayne | Setup Factory 6.0 | 1 | 02-21-2003 04:30 AM |
| INFO: Finding Shell Folders in the Registry | Support | Setup Factory 6.0 Knowledge Base | 0 | 10-10-2002 04:52 PM |
| How to find in the registry.... | Bubbancs | Setup Factory 6.0 | 1 | 01-22-2002 05:47 AM |
All times are GMT -6. The time now is 06:30 AM.






...
Linear Mode

