@rohwedder. For whatever reason it work's like a charm now. Now to modify with some programs to see what happen's.
CODE:
; The refined code:
; Allows (almost) an infinite number of actions while holding defined hotkey with increasing soundbeep
Tooltips := {}
Tooltips.RAlt := ["Customized Tooltip for action 1"
,"Customized Tooltip for action 2","Customized Tooltip for action 3"]
Return
CheckDuration:
RegExMatch(A_ThisHotkey, "\W$|\w*$", Hotkey)
CheckTooltip := Func("CheckTooltip").Bind(Hotkey,A_TickCount)
SetTimer,% CheckTooltip, -1
KeyWait,% Hotkey
SetTimer,% CheckTooltip, Off
ToolTip
Return
CheckTooltip(Hotkey, Start) {
Global Action, Tooltips
Static OldAction, OldStart
SetTimer,,% GetKeyState(Hotkey,"P")?-25:"Off"
While, (A_TickCount-Start) > 500*(A_Index-1) ; simply every 500ms
Action := A_Index
IF (Action = OldAction) And (Start = OldStart)
Return
ToolTip,% (Different := Tooltips[Hotkey, OldAction := Action])
? Different : "Release " Hotkey " to trigger Action " Action
SoundBeep, 440*2**(Action/12), (200, OldStart := Start)
}
; Example:
RAlt::
Gosub CheckDuration
Switch Action
{
Case 1:msgbox, first action triggered
Case 2:msgbox, second action triggered
Case 3:msgbox, third action triggered
Case 4:msgbox, fourth action triggered
Case 5:msgbox, fifth action triggered
Case 6:Run,"D:\PortableApps\specPortable\specPortable.exe"
}
Return
Statistics: Posted by jrachr — Today, 08:11