Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;~ #Persistent ; ~~~not required because this script has hotkeys
#SingleInstance Force
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetBatchLines, -1
SetControlDelay -1
SetTitleMatchMode, 2
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#IfWinActive Sierra
StepDelay := -9999999999 ; Set the delay to wait between steps
global MessageList := [[6, 0], [7, 1], [8, 2], [9, 3], [10, 4], [11, 5], [10, 4], [9, 3], [8, 2], [7, 1]]
Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
params .= A_Space . param
}
ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA"
if not A_IsAdmin
{
If A_IsCompiled
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
Else
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1)
ExitApp
}
#IfWinActive Sierra
Sequence:
; CustomMessage uses SendMessage. Different values are used depending on Index - see the
; function definition at the end.
CustomMessage(Index)
TimerSet := A_TickCount ; Record when the timer was started. This is used for the countdown
SetTimer, Sequence, % TimerLength := StepDelay ; Set the timer for the next time
Return
Wheelup:: ; Fire the next step
Controlsend,, {LAlt Down}h{LAlt Up}, ahk_exe SierraChart.exe
StepDelay := -99999999
SetTimer, asd, Off
gosub, Sequence
return
Wheeldown::
Controlsend,, {LAlt Down}h{LAlt Up}, ahk_exe SierraChart.exe
StepDelay := -99999999
SetTimer, asd, Off
if ((Index -= 2) <= -1)
Index := MessageList.MaxIndex() - 1
else if (Index = 0)
Index := MessageList.MaxIndex()
gosub, Sequence
Controlsend,, {LAlt Down}h{LAlt Up}, ahk_exe SierraChart.exe
return
WheelOnOff(State := "Off") ; WheelOnOff turns mousewheel hotkeys on and off
{
Hotkey, IfWinActive, Sierra
Hotkey, WheelUp, %State%
Hotkey, WheelDown, %State%
}
CustomMessage(ByRef Index)
{
if (++Index > 10) ; Add one to Index. If Index is > 61...
Index := 1 ; Reset to one
SendMessage, 0x1330, MessageList[Index, 1], 1, SysTabControl321, Sierra ;TCM_SETCURFOCUS = 0x1330
SendMessage, 0x1330, MessageList[Index, 2], 1, SysTabControl321, Sierra ;TCM_SETCURFOCUS = 0x1330
}
Code: Select all
StepDelay := -2500
gosub, sequence
return
Because when manually toggling, I want a different experience, as if the script was using the first 6 indexes only
That is, [[6, 0], [7, 1], [8, 2], [9, 3], [10, 4], [11, 5],
This is because it is intuitive to up/down with the mouse wheels accordingly. As opposed to pressing wheelup and the index becoming lower etc..
But then I want to quickly go back to the auto-toggling at 2500ms of the complete routine..