|
#1
|
|||
|
|||
|
Hi -
I am evaluating Visual Patch 2. Is it possible to let the User locate the install/patch directory? I would like to follow this logic: 1) check the local dir first 2) if not found, check the registry 3) if not found prompt the user to locate the application directory. Has anyone done something like this? Can you supply either directions or code? Thanks. |
|
#2
|
||||
|
||||
|
Quote:
Quote:
There are a couple different ways you could prompt the user for the application folder: using a Dialog.Input action, or using a Select Folder screen. Dialog.Input Using the Dialog.Input action is a bit easier, since you just insert the action in your On Startup script, at the end of the "-- Locate installed version" section (right after the Registry method). Something like this: Code:
-- Location method: Ask the user
-- Prompt the user for a path
if not g_InstalledVersion then
local FolderPath = Dialog.Input("Locate Software", SessionVar.Expand("Where is %ProductName% installed?"));
if FolderPath ~= "CANCEL" then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
end
You can use that dialog method with any interface style...Wizard, Dialog, even Silent if you want (although for silent patches you should really check for a command line argument instead). Select Folder screen If you're using a Wizard style install, you'll probably want to use a Select Folder screen. Start by adding the screen to your Before Patching screen list. In the Select Folder screen, replace the existing On Next script with something like this: Code:
-- These actions are performed when the Next button is clicked.
local SelectedFolder = SessionVar.Expand("%SelectedFolder%");
local FolderExists = Folder.DoesExist(SelectedFolder);
-- If the folder doesn't exist, ask the user if they want to select a different one
if not FolderExists then
local Result = Dialog.Message(VisualPatch.GetLocalizedString("MSG_FOLDER_NOT_EXIST_TITLE"), VisualPatch.GetLocalizedString("ERR_FLD_FOLDER_DOES_NOT_EXIST"), MB_RETRYCANCEL, MB_ICONEXCLAMATION);
if (Result == IDRETRY) then
Application.ExitScript();
else
Screen.Next();
end
end
-- check the provided folder to see if it contains key files
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", SelectedFolder);
--------------------------------------------------------------
-- 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
--------------------------------------------------------------
-- Jump to appropriate screen
--------------------------------------------------------------
if g_InstalledVersion then
if g_InstalledVersion == VisualPatch.GetTargetVersion() then
-- The target version was found
Screen.Jump("Software is Current");
else
-- An out-of-date version was found
Screen.Jump("Ready to Patch");
end
else
-- No version was found
Screen.Jump("Cannot Locate Software");
end
Code:
if not g_InstalledVersion then
Screen.SetStartScreen("Select Folder");
Application.ExitScript();
end
__________________
--[[ Indigo Rose Software Developer ]] |
|
#3
|
|||
|
|||
|
Lorne -
Thanks - I figured out some of the code myself, but I really needed the Application.ExitScript() method. Now, it works like a champ. |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Setup Factory and VS 2005 | vazir786 | Setup Factory 7.0 Discussion | 4 | 01-13-2006 09:47 PM |
| HOWTO: Distribute an AutoPlay Application with Setup Factory 6.0 | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-25-2002 03:33 PM |
| HOWTO: Make an AutoPlay Application Expire | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-09-2002 11:10 AM |
| HOWTO: Prompt the User for Confirmation Before Exiting | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-03-2002 10:50 AM |
| INFO: How to Set the Default Application Directory | Support | Setup Factory 6.0 Knowledge Base | 0 | 09-25-2002 01:02 PM |
All times are GMT -6. The time now is 10:22 PM.







Linear Mode

