This program is usefull if you make some task, for many times, in few minutes, with fewest hotkeys

,but maybe usefull in many other contexts.
Description:
this script assign different action to the same hotkeys(definied in file hotkeys.kiu that should look like this
Code:
[hks]
hks=XButton1|XButton2
).
To change current mode(the actual actions definied for current hotkeys) you must press wheel up or down while holding down right mouse button.
The modes are definied in modes.kiu:
Code:
send ^c|send {LButton}{CTRL down}v{CTRL up}|
send ^x|send !c|
send ^s|send ^z|
send {Enter}|Send {BS}|
send {LButton}{Tab}|send msgbox
modifier CTRL|modifier ALT|
modifier SHIFT|modifier WIN|
run E:\ahk_scripts\new\ahk2exe.exe|run E:\ahk_scripts\new\my_functions.exe|
run E:\programmi\Aveicon\AveIcon.exe|run E:\programmi\XnView-win-full\XnView\xnview.exe|
run E:\ahk_scripts\new\mouse_modes|run E:\ahk_scripts\new\radialm_new\source3|
run E:\ahk_scripts\new|run e:\programmi|
changeword %§%|changeword { § }|
thiskey|thiskey|
as you can see each line as the following sintax:
commandforfirstHK[%A_Tab%option] | commandforsecondHK[%A_Tab%option] |commandforthirdHK[%A_Tab%option] |
etc.,as many as number of hotkeys.
for now are implemented only send,run and some other command,but you can define yours.
This is the script:
Code:
;Author: Salvatore Agostino Romeo(romeo84ATgmail)
currentMode:=0
mode_on=False
initializeModes()
#SingleInstance force
Return
;toggle modes on/off
^!Space::
if(mode_on="True")
{
mode_on=False
Menu,tray,Icon , mm_images\off.ico,,1
ToolTip,Modes deactivated
SetTimer,stoptt,3000
deactivateModes()
}
Else
{
mode_on=True
activateModes()
ToolTip,Modes activated
SetTimer,stoptt,3000
Menu,tray,Icon , mm_images\on.ico,,1
}
Return
;change mode with rbutton down + wheel
WheelUp::
GetKeyState,state,RButton,P
if(state ="D")
prevMode()
Else
Send,{WheelUp}
Return
WheelDown::
GetKeyState,state,RButton,P
if(state ="D")
nextMode()
Else
Send,{WheelDown}
Return
;exit app
^Esc::
ExitApp
Return
activateModes()
{
global
IniRead, hks, hokeys.kiu, hks, hks
StringSplit, hk, hks, |
Loop,%hk0%
{
current_hk:=hk%A_Index%
Hotkey,%current_hk%,takeAction,on
}
Return
}
deactivateModes()
{
global
IniRead, hks, hokeys.kiu, hks, hks
StringSplit, hk, hks, |
Loop,%hk0%
{
current_hk:=hk%A_Index%
Hotkey,%current_hk%,off
}
Return
}
nextMode()
{
global
;if disabled,enable modes
if(currentMode=0)
gosub,^!Space
currentMode++
if(currentMode>maxMode)
currentMode:=maxMode
StringSplit, butt, mode%currentMode%, |
modi=
numberofloop:=butt0-1
Loop,%numberofloop%
modi:=modi "`n-" hk%A_Index% ": " butt%A_Index%
ToolTip,Mode --> %currentMode%:%modi%
SetTimer,stoptt,3000
Return
}
prevMode()
{
global
currentMode--
if(currentMode<0)
currentMode:=0
;if selected mode0,disable modes
if(currentMode=0)
gosub,^!Space
StringSplit, butt, mode%currentMode%, |
modi=
numberofloop:=butt0-1
Loop,%numberofloop%
modi:=modi "`n-" hk%A_Index% ": " butt%A_Index%
ToolTip,Mode --> %currentMode%:%modi%
SetTimer,stoptt,3000
Return
}
;read modes from modes.kiu
initializeModes()
{
global
FileRead, mode, modes.kiu
StringSplit, mode, mode, `n
maxMode:=mode0
mode=
mode0=thiskey|thiskey|
Return
}
takeAction:
;I don't know how some variables are blank at this point,so I re-initialize them
initializeModes()
IniRead, hks, hokeys.kiu, hks, hks
StringSplit, hk, hks, |
StringSplit, hkac, mode%currentMode%, |
Loop,%hk0%
{
StringSplit,butt%A_Index% , hkac%A_Index%, %A_Tab%
if(A_ThisHotkey=hk%A_Index%)
{
option:=butt%A_Index%2
Label:=butt%A_Index%1
Gosub,%Label%
Break
}
}
Return
;unshow tooltip
stoptt:
SetTimer,stoptt,off
ToolTip,
Return
;starting with possible commands definied for modes
msg:
MsgBox,% option
Return
thiskey:
Send,{%A_ThisHotkey%}
Return
send:
send,%option%
Return
run:
run,%option%
Return
modifier:
Send,{%option% down}
KeyWait, %A_ThisHotkey%
Send,{%option% up}
Return
changeword:
Send,{LButton 2}
tempx=%Clipboard%
Clipboard=
Send,^x
StringSplit, op, option, §
Send,%op1%%Clipboard%%op2%
Clipboard=%tempx%
Return
For the script to work you must place in the same folder:
this script,modes.kiu,hotkeys.kiu and eventually some icons like described in code.
Finally this is a complete pack,comprehensive of icons and exe too
http://autohotkey.net/file/users/Members/kiu/mouse%20modes%200.5.1.zip
Please tell me about,especially if you doesn't understand what this script can do.