From time to time there are feature requests and wishes that are too individual to be implemented in the IDE and can easily be done in Autohotkey. For those who do not already know this sometimes weird but outstandingly powerful tool here is a little - all but comprehensive - introduction.
You can get AHK here:http://ahkscript.org/download/
--
AHK is a mixture of Hotkey, Hotstring and Scripting tool. You can very easily modify single keys, key-combinations as well as define per app or system-wide hotstrings (key triggerd strings). AHK provides powerful commands for Window manipulations and you can even write complete GUI apps for Windows. In fact you will find Linux users in their forums to envy AHK for its power. Sounds like the perfect tool and, well it is. On the other hand it's syntax is rather inconsistent and not every command will work with every target. Some trial end error is required but once a certain solution is working I never experienced any instability or unpredictable behaviour.
Autohotkey is a runtime for 32 and 64bit Windows of all flavours and uses plain text files with .ahk suffix as input. Scripts may be compiled to .exe as well. AHK comes with AutoIt Windows Spy, a great source of information. Have a look at it.
A typical script looks like this - you may copy it or use the attached zip as a starting point. Don't forget to reload script after changes (right mouse on traycon):
You can get AHK here:http://ahkscript.org/download/
--
AHK is a mixture of Hotkey, Hotstring and Scripting tool. You can very easily modify single keys, key-combinations as well as define per app or system-wide hotstrings (key triggerd strings). AHK provides powerful commands for Window manipulations and you can even write complete GUI apps for Windows. In fact you will find Linux users in their forums to envy AHK for its power. Sounds like the perfect tool and, well it is. On the other hand it's syntax is rather inconsistent and not every command will work with every target. Some trial end error is required but once a certain solution is working I never experienced any instability or unpredictable behaviour.
Autohotkey is a runtime for 32 and 64bit Windows of all flavours and uses plain text files with .ahk suffix as input. Scripts may be compiled to .exe as well. AHK comes with AutoIt Windows Spy, a great source of information. Have a look at it.
A typical script looks like this - you may copy it or use the attached zip as a starting point. Don't forget to reload script after changes (right mouse on traycon):
B4X:
;use semicolon for single line coments
#persistent ; make script resident - in most cases not necessary but never a bad idea
#WinActivateForce ; use more forceful windows activation, not necessary but sometimes better
DetectHiddenWindows, Off ; don't match titles of hidden windows with WinTitle/WinText
SetTitleMatchMode, 2 ; WinTitle may occur anywhere to match
/*
begin multiline comment
Hotkeys are very easily assigned:
Key::TargetKey e.g. F8::LWin lets F8 fire LeftWin
SpecialKeys can be adressed by:
# = WIN-Taste
! = Alt
^ = Ctrl
+ = Shift
Single line Hotkeys are not allways reliable. While Key::AltTab works only as a single line Hotkey many others only work with send which is more reliable e.g:
F8::
send, {LWin}
return
End multiline comment
*/
; some general purpose and B4A examples:
; hold left mouse button and press right button to alt-tab through windows
;~ prevents consuming LButton:
~LButton & RButton::AltTab
;run calculator if NumLock is pressed (and prevent keypad to be deactivated):
NumLock::
ifwinexist, ahk_exe calc.exe
{
winactivate, ahk_exe calc.exe
return
}
else
{
run, calc.exe
return
}
; Ctrl-PageUp/Down: Fullscreen on/off for (allmost) all scalable apps
; removes title bar and boarders and maximizes window
; works with all scalable windows but e.g. Firefox doesn't benefit, its own fullscreen is better
; more screen real-estate in B4A!
^PgUp::
WinSet, style, -0xC40000, A
Send, #{Up}
return
^PgDn::
WinSet, style, +0xC40000, A
Send, #{Down}
return
;now some B4A related:
;======================== B4A ============================
; let these work only when B4A window is activated:
#IfWinActive, ahk_exe Basic4android.exe
; Hotstring defined by :*:trigger::string
; typing .log writes Log(") and positions the cursor after "
:*:.Log::Log("){Left}
; typing .sub sends Sub, blank, new line, End Sub and positions curser after blank
:*:.Sub::Sub {Enter}End Sub{Up}{End}
;.If creates a complete If Then Else structure
:*:.If::If Then{Enter}{Enter}Else{Tab}{Enter}End If{Up}{Up}{End}{Tab}{Up}{End}{Left}{Left}{Left}{Left}{Left}
:*:.Else If::Else If Then{Left}{Left}{Left}{Left}{Left}
:*:endif::End If
; mostly useless capslock triggers event-autocomplete
CapsLock::
send, Sub
send, {Space}
send, {Tab}
return
;AppsKey (windows menu key) triggers autocomplete
AppsKey::
Send, ^{Space}
return
;F1 triggers compile in background
F1::
send, !3
return
#IfWinActive ; end B4A only section
;======================== B4A ============================
; have fun!
Attachments
Last edited: