Skip to content

Commit

Permalink
- Updated version from 1.3.1 to 1.3.2.
Browse files Browse the repository at this point in the history
- Changed file paths to use an absolute path (via A_ScriptDir) instead of a relative path to fix issues when the working directory is not the same as the directory that the script is in.
  • Loading branch information
deadlydog committed May 4, 2016
1 parent c703954 commit deb8d72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
36 changes: 18 additions & 18 deletions AHKCommandPicker.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ IDEAS:
;==========================================================
; Global Variables - prefix everything with "cp" for Command Picker, so that variable/function names are not likely to conflict with user variables/function names.
;==========================================================
_cpWindowName := "AHK Command Picker v1.3.1"
_cpWindowName := "AHK Command Picker v1.3.2"
_cpWindowGroup := "" ; The group that will hold our Command Picker window so we can reference it from # directive statements (e.g. #IfWinExists).
_cpCommandList := "" ; Will hold the list of all available commands.
_cpCommandSelected := "" ; Will hold the command selected by the user.
Expand All @@ -44,7 +44,7 @@ _cpDisableEscapeKeyScriptReloadUntilAllCommandsComplete := false ; Variable that
;----------------------------------------------------------
; AHK Command Picker Settings - Specify the default Command Picker Settings, then load any existing settings from the settings file.
;----------------------------------------------------------
_cpSettingsFileName := "AHKCommandPicker.settings"
_cpSettingsFilePath := A_ScriptDir . "\AHKCommandPicker.settings"
_cpShowAHKScriptInSystemTray := true
_cpWindowWidthInPixels := 700
_cpFontSize := 10
Expand All @@ -63,13 +63,13 @@ CPLoadSettings()
CPLoadSettings()
{
; Include any global setting variables the we need.
global _cpSettingsFileName, _cpWindowWidthInPixels, _cpNumberOfCommandsToShow, _cpShowAHKScriptInSystemTray, _cpShowSelectedCommandWindow, _cpCommandMatchMethod, _cpNumberOfSecondsToShowSelectedCommandWindowFor, _cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand, _cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand, _cpEscapeKeyShouldReloadScriptWhenACommandIsRunning
global _cpSettingsFilePath, _cpWindowWidthInPixels, _cpNumberOfCommandsToShow, _cpShowAHKScriptInSystemTray, _cpShowSelectedCommandWindow, _cpCommandMatchMethod, _cpNumberOfSecondsToShowSelectedCommandWindowFor, _cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand, _cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand, _cpEscapeKeyShouldReloadScriptWhenACommandIsRunning

; If the file exists, read in its contents and then delete it.
If (FileExist(_cpSettingsFileName))
If (FileExist(_cpSettingsFilePath))
{
; Read in each line of the file.
Loop, Read, %_cpSettingsFileName%
Loop, Read, %_cpSettingsFilePath%
{
; Split the string at the = sign
StringSplit, setting, A_LoopReadLine, =
Expand All @@ -96,25 +96,25 @@ CPLoadSettings()
CPSaveSettings()
{
; Include any global setting variables the we need.
global _cpSettingsFileName, _cpWindowWidthInPixels, _cpNumberOfCommandsToShow, _cpShowAHKScriptInSystemTray, _cpShowSelectedCommandWindow, _cpCommandMatchMethod, _cpNumberOfSecondsToShowSelectedCommandWindowFor, _cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand, _cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand, _cpEscapeKeyShouldReloadScriptWhenACommandIsRunning
global _cpSettingsFilePath, _cpWindowWidthInPixels, _cpNumberOfCommandsToShow, _cpShowAHKScriptInSystemTray, _cpShowSelectedCommandWindow, _cpCommandMatchMethod, _cpNumberOfSecondsToShowSelectedCommandWindowFor, _cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand, _cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand, _cpEscapeKeyShouldReloadScriptWhenACommandIsRunning

; Delete and recreate the settings file every time so that if new settings were added to code they will get written to the file.
If (FileExist(_cpSettingsFileName))
If (FileExist(_cpSettingsFilePath))
{
FileDelete, %_cpSettingsFileName%
FileDelete, %_cpSettingsFilePath%
}

; Write the settings to the file (will be created automatically if needed)
; Setting name in file should be the variable name, without the "_cp" prefix.
FileAppend, CPShowAHKScriptInSystemTray=%_cpShowAHKScriptInSystemTray%`n, %_cpSettingsFileName%
FileAppend, WindowWidthInPixels=%_cpWindowWidthInPixels%`n, %_cpSettingsFileName%
FileAppend, NumberOfCommandsToShow=%_cpNumberOfCommandsToShow%`n, %_cpSettingsFileName%
FileAppend, CommandMatchMethod=%_cpCommandMatchMethod%`n, %_cpSettingsFileName%
FileAppend, ShowSelectedCommandWindow=%_cpShowSelectedCommandWindow%`n, %_cpSettingsFileName%
FileAppend, NumberOfSecondsToShowSelectedCommandWindowFor=%_cpNumberOfSecondsToShowSelectedCommandWindowFor%`n, %_cpSettingsFileName%
FileAppend, ShowSelectedCommandWindowWhenInfoIsReturnedFromCommand=%_cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand%`n, %_cpSettingsFileName%
FileAppend, NumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand=%_cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand%`n, %_cpSettingsFileName%
FileAppend, EscapeKeyShouldReloadScriptWhenACommandIsRunning=%_cpEscapeKeyShouldReloadScriptWhenACommandIsRunning%`n, %_cpSettingsFileName%
FileAppend, CPShowAHKScriptInSystemTray=%_cpShowAHKScriptInSystemTray%`n, %_cpSettingsFilePath%
FileAppend, WindowWidthInPixels=%_cpWindowWidthInPixels%`n, %_cpSettingsFilePath%
FileAppend, NumberOfCommandsToShow=%_cpNumberOfCommandsToShow%`n, %_cpSettingsFilePath%
FileAppend, CommandMatchMethod=%_cpCommandMatchMethod%`n, %_cpSettingsFilePath%
FileAppend, ShowSelectedCommandWindow=%_cpShowSelectedCommandWindow%`n, %_cpSettingsFilePath%
FileAppend, NumberOfSecondsToShowSelectedCommandWindowFor=%_cpNumberOfSecondsToShowSelectedCommandWindowFor%`n, %_cpSettingsFilePath%
FileAppend, ShowSelectedCommandWindowWhenInfoIsReturnedFromCommand=%_cpShowSelectedCommandWindowWhenInfoIsReturnedFromCommand%`n, %_cpSettingsFilePath%
FileAppend, NumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand=%_cpNumberOfSecondsToShowSelectedCommandWindowForWhenInfoIsReturnedFromCommand%`n, %_cpSettingsFilePath%
FileAppend, EscapeKeyShouldReloadScriptWhenACommandIsRunning=%_cpEscapeKeyShouldReloadScriptWhenACommandIsRunning%`n, %_cpSettingsFilePath%
}

;==========================================================
Expand Down Expand Up @@ -146,7 +146,7 @@ DummyCommand(parameters = "")
; return false ; (optional) Return false to not display the command text after running the command.
; }
;==========================================================
#Include CommandScriptsToInclude.ahk
#Include %A_ScriptDir%\CommandScriptsToInclude.ahk

;==========================================================
; Hotkey to launch the Command Picker window.
Expand Down
10 changes: 5 additions & 5 deletions CommandScriptsToInclude.ahk
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
;====================================================================
; Include our utility functions used by some of the Commands first.
;====================================================================
#Include Commands\UtilityFunctions.ahk
#Include %A_ScriptDir%\Commands\UtilityFunctions.ahk


;====================================================================
; Include the files with the Commands we want to include in the picker.
; You can put all of your commands in a single file, or break them into
; separate files (e.g General.ahk, Work.ahk, Personal.ahk, HomePC.ahk, etc.).
;====================================================================
#Include Commands\DefaultCommands.ahk
#Include Commands\MyCommands.ahk
#Include %A_ScriptDir%\Commands\DefaultCommands.ahk
#Include %A_ScriptDir%\Commands\MyCommands.ahk


;====================================================================
; Include any files containing HotKeys/HotStrings last, as any AddCommand
; functions defined after a HotKey/HotString won't be loaded at startup,
; and hence, won't show up in the Command Picker list.
;====================================================================
#Include Commands\DefaultHotkeys.ahk
#Include Commands\MyHotkeys.ahk
#Include %A_ScriptDir%\Commands\DefaultHotkeys.ahk
#Include %A_ScriptDir%\Commands\MyHotkeys.ahk

0 comments on commit deb8d72

Please sign in to comment.