[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: One (was two) handy AutoHotKey script



Update to my RUN.AHK AutoHotKey script.

Changelog:
- RUN.INI (with sample alias) is created if not already present
- Entering "?" (no quotes) opens RUN.INI for editing
- FIXED: Focus does not return to original window if input is 
  or empty

; ************************************************
; RUN.AHK -- AutoHotKey [CLD rev.4/18/15]
; Open|Switch_to program, URL, folder, etc., etc.
;
; Create aliases (command abbreviatons) in RUN.INI
; Enter "?" to edit RUN.INI
; ************************************************
;
; Key assignment (change as desired):
; NumPadAdd::
;
#Persistent
#SingleInstance force
#WinActivateForce
StringCaseSense, Off
DetectHiddenText, On
DetectHiddenWindows, On
SetTitleMatchMode, RegEx
SplitPath, A_ScriptFullPath,,IniDir,,IniFile
IniFile = %IniDir%\%IniFile%.INI
IfNotExist, %IniFile%
{
 Input = [Run]`n;RUN.AHK aliases. Example:`nG=http://www.google.com/`n
 FileAppend, %Input%, %IniFile%
}
WinGetTitle, CrntWin, A
Input = Enter program name, window title, alias or "?"
InputBox, Input, Run, %Input%,,350,155,,,,10
If (ErrorLevel or StrLen(Input) = 0)
{
 WinActivate, %CrntWin%
 Exit
}
If (Input = "?")
{
 Run, %IniFile%
 Exit
}
IniRead, KeyValue, %IniFile%, Run, %Input%, %A_Space%
If (StrLen(KeyValue) > 0)
{
 Input = %KeyValue%
}
colon = :
dot = .
If (InStr(Input, colon) > 0 or InStr(Input, dot) > 0)
{
 Run, %Input%
 Exit
}
IfWinExist, i).*%Input%.*
{
 WinActivate, i).*%Input%.*
; Maximize active window (my preference)
; If (InStr(Input, "vdos") < 1)
;  WinMaximize, A
 Exit
}
; end RUN.AHK
; ************************************************

--
Carl Distefano
cld@xxxxxxxx