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

Re: One (was two) handy AutoHotKey script



More tweaks to RUN.AHK. Added a "SetBatchLines -1" instruction, which
eliminates the 10 millisecond pause between the execution of each
line that AutoHotKey adds by default. Response is noticeably snappier
(not that it was slow before).

Also added user variables for width and height of the input box,
since it may display differently on different systems.

Also, an option to maximize the active window after opening or
switching to it.

I'm finding this thing addictive. It's great to have a Xy-like
Windows command line!


; ************************************************
; RUN.AHK -- AutoHotKey [CLD rev.4/19/15]
; Open|Switch_to program, URL, folder, etc., etc.
;
; Create aliases (command abbreviatons) in RUN.INI
; Enter "?" to edit RUN.INI
; ************************************************
;
; User Variables (change as desired)
; ----------------------------------
; Hotkey assignment:
; NumPadAdd::
;
; Input Box dimensions:
width = 350
height = 155
;
; Maximize active window? (Y|N)
MAW = N
; ----------------------------------
;
#NoEnv
#Persistent
#SingleInstance force
#WinActivateForce
DetectHiddenText, On
DetectHiddenWindows, On
SetBatchLines -1
SetTitleMatchMode, RegEx
StringCaseSense, Off
StringUpper, MAW, MAW
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%,,%width%,%height%,,,,15
If (ErrorLevel or StrLen(Input) = 0)
{
 WinActivate, %CrntWin%
 Exit
}
If (Input = "?")
{
 Run, %IniFile%
 GoSub, WinMax
}
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%
 GoSub, WinMax
}
IfWinExist, i).*%Input%.*
 WinActivate, i).*%Input%.*
WinMax:
If (MAW = "Y" and InStr(Input, "vDos") < 1)
 WinMaximize, A
Exit
; end RUN.AHK
; ************************************************


--
Carl Distefano
cld@xxxxxxxx