Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Sep 2006
    Posts
    19

    Star VP can't find app from registry

    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. #2
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    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. #3
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Quote Originally Posted by beeneeb View Post
    The program is installed at: C:\ProgramFiles\York Furnace Service Guide
    BTW, the program files folder usually has a space between the words Program and Files, like so:

    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. #4
    Join Date
    Sep 2006
    Posts
    19
    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. #5
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    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. #6
    Join Date
    Sep 2006
    Posts
    19
    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. #7
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Quote Originally Posted by beeneeb View Post
    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);
    It's failing with error code 1002, which is "The specified path was not found." So it's probably the path that is incorrect.

    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. #8
    Join Date
    Sep 2006
    Posts
    19
    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. #9
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    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. #10
    Join Date
    Sep 2006
    Posts
    19
    Quote Originally Posted by Lorne View Post
    Try adding some dialog boxes to the script to see what the values of Folder and TargetFileName are immediately before the File.Find action.
    How exactly do I do that?

  11. #11
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Use Dialog.Message() actions. Search for "Debugging Your Scripts" in the help index.
    --[[ Indigo Rose Software Developer ]]

  12. #12
    Join Date
    Sep 2006
    Posts
    19
    The only thing that I can figure out is that "AppFolder" has a "nil" value even after it checks the registry.

  13. #13
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    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. #14
    Join Date
    Sep 2006
    Posts
    19
    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. #15
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    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
    I added the escaped quotes to make it easier to see any extra characters (like spaces) in the values.
    Last edited by Lorne; 01-31-2007 at 02:13 PM.
    --[[ Indigo Rose Software Developer ]]

Similar Threads

  1. App Paths registry key being created?
    By DanCooperstock in forum Setup Factory 7.0
    Replies: 0
    Last Post: 12-29-2004, 08:58 PM
  2. System trap app & Internet calls
    By Lee_Benson in forum AutoPlay Media Studio 5.0
    Replies: 11
    Last Post: 11-23-2003, 07:15 PM
  3. Registry Features
    By Dwayne in forum Setup Factory 6.0
    Replies: 1
    Last Post: 02-21-2003, 03:30 AM
  4. INFO: Finding Shell Folders in the Registry
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-10-2002, 03:52 PM
  5. How to find in the registry....
    By Bubbancs in forum Setup Factory 6.0
    Replies: 1
    Last Post: 01-22-2002, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts