From 91e79130e7039b00090665e22759619c0a9da03c Mon Sep 17 00:00:00 2001 From: mbirth Date: Tue, 13 Mar 2007 23:34:47 +0000 Subject: [PATCH] + specify paths to add to local PATH variable + show version number + "Cancel"-button to erase registry settings if there were some upon launch (if LaunchPad didn't shutdown correctly and registry settings were left) x Unattended-switch didn't do cleanup of registry and regsvr32 --- U3Helper.ahk | 51 +++++++++++++++++++++++++++++++++++++++++--------- U3Helperex.ini | 6 ++++++ 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/U3Helper.ahk b/U3Helper.ahk index 6d78513..64ced41 100644 --- a/U3Helper.ahk +++ b/U3Helper.ahk @@ -2,6 +2,7 @@ #NoEnv #Include mb_IniTools.ahk #Include mb_TextTools.ahk +U3HVer = 1.2 EnvGet U3_DEVICE_SERIAL, U3_DEVICE_SERIAL ; serial number of device (copy protection) EnvGet U3_DEVICE_PATH, U3_DEVICE_PATH ; drive letter to device (F:) @@ -61,7 +62,7 @@ If 1 = config ; ########################################################################## Menu Tray, Icon - TrayTip Preparing %AppName% ..., U3Helper`n(c)2006 Markus Birth`nmbirth@webwriters.de, 3, 1 + TrayTip Preparing %AppName% ..., U3Helper %U3HVer%`n(c)2006 Markus Birth`nmbirth@webwriters.de, 3, 1 Status("Checking registry settings...") keycount = 0 @@ -88,7 +89,7 @@ If 1 = config Status("") IniWrite 1, %INIFile%, U3Helper, KeepSettings If (Unattended = "0") - { + { MsgBox 4132, %AppName%: Duplicate settings, Settings for %AppName% were already found on this PC. Do you want to use them?`n`nIf you select NO, the local settings will be overwritten by those saved on your U3 stick.`n(They have been backed up and can be restored upon eject of the stick.) IfMsgBox Yes { @@ -185,7 +186,7 @@ Else If 1 = unconfig } Else { - ; U3 stick plugged in + ; U3 stick plugged in IniRead ForeignSettings, %INIFile%, U3Helper, ForeignSettings, 0 If (ForeignSettings <> "0") { @@ -257,16 +258,20 @@ Else If 1 = unconfig If (KeepSettings <> "0") { If (Unattended = "0") - { - MsgBox 4132, %AppName%: Foreign settings, Do you want to keep the changed settings for %AppName%?`n`n(Select No to revert to the former settings.) + { + MsgBox 4131, %AppName%: Foreign settings, Do you want to keep the changed settings for %AppName%?`n`n(Select No to revert to the former settings. Cancel to erase settings.) IfMsgBox No { RevertSettings := "1" } + IfMsgBox Cancel + { + KeepSettings := "0" + } } Else { - RevertSettings := "1" + RevertSettings := "1" } } If (KeepSettings = "0" or RevertSettings = "1") @@ -284,7 +289,7 @@ Else If 1 = unconfig } } } - If (KeepSettings = "0") + If (KeepSettings = "0" or Unattended = "1") { Loop %regdel0% { @@ -334,7 +339,7 @@ Else If 1 = unconfig Status("") If (U3_IS_DEVICE_AVAILABLE = "true") - { + { IniDelete %INIFile%, U3Helper, ForeignSettings IniDelete %INIFile%, U3Helper, KeepSettings } @@ -344,10 +349,36 @@ Else If 1 = appstart EnvSet USERPROFILE, %U3_APP_DATA_PATH% EnvSet HOMEPATH, %U3_APP_DATA_PATH% EnvSet APPDATA, %U3_APP_DATA_PATH%\Application Data + + ; add custom PATH directories + EnvGet ePATH, PATH + IniGetKeys("envdir", INIFile, "EnvPath") + Loop %envdir0% + { + CurPath := envdir%A_Index% + StringReplace CurPath, CurPath, % "%ALLUSERSPROFILE%", %eALLUSERSPROFILE%, A + StringReplace CurPath, CurPath, % "%APPDATA%", %eAPPDATA%, A + StringReplace CurPath, CurPath, % "%CommonProgramFiles%", %eCommonProgramFiles%, A + StringReplace CurPath, CurPath, % "%HOMEPATH%", %eHOMEPATH%, A + StringReplace CurPath, CurPath, % "%ProgramFiles%", %eProgramFiles%, A + StringReplace CurPath, CurPath, % "%SystemRoot%", %eSystemRoot%, A + StringReplace CurPath, CurPath, % "%USERPROFILE%", %eUSERPROFILE%, A + StringReplace CurPath, CurPath, % "%WINDIR%", %ewindir%, A + StringReplace CurPath, CurPath, % "%TEMP%", %eTEMP%, A + StringReplace CurPath, CurPath, % "%U3_APP_DATA_PATH%", %U3_APP_DATA_PATH%, A + StringReplace CurPath, CurPath, % "%U3_DEVICE_DOCUMENT_PATH%", %U3_DEVICE_DOCUMENT_PATH%, A + StringReplace CurPath, CurPath, % "%U3_DEVICE_EXEC_PATH%", %U3_DEVICE_EXEC_PATH%, A + StringReplace CurPath, CurPath, % "%U3_HOST_EXEC_PATH%", %U3_HOST_EXEC_PATH%, A + + ePATH := CurPath . ";" . ePATH + } + EnvSet PATH, %ePATH% + IfNotExist %APPDATA% { FileCreateDir %APPDATA% } + cmdl := AppExe Loop %0% { @@ -364,8 +395,10 @@ Else If 1 = appstop ToolTip Closing %AppName% ... + SplitPath AppExe, AppFile, null, null, null, null + TryClose: - Process Exist, %AppExe% + Process Exist, %AppFile% If ErrorLevel ProgPID = %ErrorLevel% Else diff --git a/U3Helperex.ini b/U3Helperex.ini index 7468c3a..42e8e19 100644 --- a/U3Helperex.ini +++ b/U3Helperex.ini @@ -34,3 +34,9 @@ safe.ind ; %ProgramFiles%, %SystemRoot%, %TEMP%, %USERPROFILE%, %WINDIR%, ; %U3_APP_DATA_PATH%, %U3_DEVICE_DOCUMENT_PATH%, %U3_DEVICE_EXEC_PATH% %ALLUSERSPROFILE%\Application Data\Spybot - Search & Destroy + +[EnvPath] +; enter folders to be added to the PATH environment variable +; upon running the application. All variables mentioned under +; [FileDelete] get replaced. +%U3_HOST_EXEC_PATH%\lib\gtk\bin