Mode-Roll Hotkeys (keyboard shortcuts) Setup


Basic one-touch shortcut Hotkeys are already active in Modal-Surf as you should have Java-Script enabled. These include: Browser Back & Forward, Stop & Play Chords / Drums, Jump Back up to 12 Chords or Back to the Start of the Loop, Copy & Paste Modal Pages, and More. Our Advanced Hotkeys are made possible by the free software AutoHotkey for Windows, enabling additional one-touch controls for Saving and Loading Songs. Reference the complete hotkey layout under 'Guide' while Modal-Surfing as basic & advanced features are indicated. Set up advanced hotkeys by following the detailed steps below:

 

Modal-Surf Hotkey Layout
 


Step #1:

Install AutoHotKey *Important!! Use version 1.1*



Step #2:

You can Unpin icon from Taksbar


Step #3:

Right-Click Desktop > New > AutoHotKey Script


________________________________________________________

Step #5:

Copy the following Text and Paste it into the AutoHotkey
file, overwriting the existing text since the same text is
provided here simplified. Close the Notepad and Save.


Step #4:

Right-Click the Hotkey Icon > Open With Notepad


________________________________________________________

Step #6:

Double-Click the Hotkey Icon to Run the Hotkey Script
Optionally Right-Click the Hotkey Icon > Edit Script
Set your own custom tempos, Beats Per Minute,
as described in the script. These are assigned to
24 Buttons to be shown in the Tempo Controls.

#NoEnv
#Persistent
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%

GroupAdd, modalsurf4, Mode-Roll
GroupAdd, modalsurf0, Mode-Roll . Modal-Surf
GroupAdd, modalsurf2, Mode-Roll . Modal-Surf
GroupAdd, modalsurf8, Mode-Roll . Modal-Surf
GroupAdd, modalsurf8, Mode-Roll . Rythm Select
GroupAdd, modalsurf8, Mode-Roll . Rhythm Select

GroupAdd, modalsurf0, Color-Guitar Jam To Tracks
GroupAdd, modalsurf0, Color-Guitar Jam To Songs
GroupAdd, modalsurf4, Color-Guitar

GroupAdd, modalsurf6, ahk_exe obs64.exe
GroupAdd, modalsurf6, ahk_exe obs32.exe

;------------------predefined variables
Stop := True
bpmval := 98
bpmdec := 0
BPC := 8
CrudAdd := 0
pumped := 0
spacer := " "
spaces := " "

Esc::
MsgBox 0, Mode-Roll.Com, Hotkeys Are Closing Now, 1
ExitApp
Return

;--------set custom tempos----example: button A is Abtn
;--------bpm 103.49 is set as bpmval :=103, bpmdec :=49

Abtn:
bpmval := 103
bpmdec := 49
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Bbtn:
bpmval := 119
bpmdec := 63
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Cbtn:
bpmval := 100
bpmdec := 15
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Dbtn:
bpmval := 72
bpmdec := 87
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Ebtn:
bpmval := 105
bpmdec := 33
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Fbtn:
bpmval := 88
bpmdec := 53
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Gbtn:
bpmval := 96
bpmdec := 87
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Hbtn:
bpmval := 112
bpmdec := 69
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Ibtn:
bpmval := 101
bpmdec := 73
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Jbtn:
bpmval := 87
bpmdec := 33
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Kbtn:
bpmval := 112
bpmdec := 97
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Lbtn:
bpmval := 104
bpmdec := 43
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Mbtn:
bpmval := 112
bpmdec := 97
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Nbtn:
bpmval := 103
bpmdec := 49
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Obtn:
bpmval := 109
bpmdec := 07
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Pbtn:
bpmval := 111
bpmdec := 05
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Qbtn:
bpmval := 105
bpmdec := 31
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Rbtn:
bpmval := 112
bpmdec := 97
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Sbtn:
bpmval := 102
bpmdec := 37
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Tbtn:
bpmval := 92
bpmdec := 61
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Ubtn:
bpmval := 105
bpmdec := 31
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Vbtn:
bpmval := 88
bpmdec := 41
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Wbtn:
bpmval := 95
bpmdec := 47
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

Ybtn:
bpmval := 115
bpmdec := 23
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%
return

;-----------------------------------------start and cue

#IfWinActive, ahk_group modalsurf8
Numpad6::
^6::
{
IfWinActive, Mode-Roll . Rythm Select
{
Sleep, 50
Send, z
Sleep, 500
}
Else
{
Send ^{Tab}
Sleep, 300
Send, z
Sleep, 500
}
}
Send ^+{Tab}
Sleep, 500
Send, k
Sleep, 800
Send, j
return

;------------------------------------------OBS start record

#IfWinExist, ahk_group modalsurf6
\::
WinActivate
Sleep, 500
IfWinActive, ahk_group modalsurf6
{
Sleep, 500
Send, +p ; use shift + p as your OBS record hotkey
Sleep, 1000
WinMinimize, ahk_group modalsurf6
Sleep, 500
IfWinExist, ahk_group modalsurf8
WinActivate
Sleep, 500
{
IfWinActive, Mode-Roll . Rythm Select
{
Sleep, 50
Send, z
Sleep, 500
}
Else
{
Send ^{Tab}
Sleep, 300
Send, z
Sleep, 500
}
}

Send ^+{Tab}
Sleep, 500
Send, k
Sleep, 800
Send, j
}
return

;-----------------------------------------OBS stop record

#IfWinExist, ahk_group modalsurf6
/::
WinActivate
Sleep, 500
IfWinActive, ahk_group modalsurf6
{
Sleep, 1000
Send, +k ; use shift + k as your OBS stop hotkey
Sleep, 500
}
return

#IfWinActive, ahk_group modalsurf6
m::
IfWinExist, ahk_group modalsurf8
WinActivate
return

;-----------------------------------------browser actions

#IfWinActive ahk_group modalsurf0
Backspace::
Send {Left}
Space::
Send {Right}
Return

;---------------------------------- to copy and rejoin a url

#IfWinActive ahk_group modalsurf2
a::
Send, c
Sleep 110
Send, 4
Sleep 145
Send, e
Return

#IfWinActive ahk_group modalsurf2
CapsLock::
Send, c
Sleep 110
Send, 3
Sleep 145
Send, e
Return

#IfWinActive ahk_group modalsurf2
!e::
!w::
^w::
^q::
^`::
Send, c
Sleep 110
Send, ^w
Sleep 145
Send, e
Return

;----------------------------to autocopy url into notepad

#IfWinActive ahk_group modalsurf2
s::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ S ] Save URL, Save Feature Requires an Active Notepad File, 2
Return
}
Send, c
Sleep 100
Send, x
Sleep 100
ifWinExist ahk_class Notepad
WinActivate
sleep 248
Send, ^v
Sleep 200
Send, {backspace 37}
Sleep 40
Send, {enter}
Send, {enter}
Sleep 340
WinMinimize
Sleep 90
Send {Right}
Return

;----------------------------to autocopy 4 urls into notepad

#IfWinActive ahk_group modalsurf2
f::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ F ] Save 4 URLs, Save Feature Requires an Active Notepad File, 2
Return
}
Loop 3
{
Send, c
Sleep 100
Send, x
Sleep 100
ifWinExist ahk_class Notepad
WinActivate
sleep 248
Send, ^v
Sleep 200
Send, {backspace 37}
Sleep 40
Send, {enter}
Send, {enter}
Sleep 340
WinMinimize
Sleep 90
Send {Right}
sleep 920
}
Send, c
Sleep 100
Send, x
Sleep 100
ifWinExist ahk_class Notepad
WinActivate
sleep 248
Send, ^v
Sleep 200
Send, {backspace 37}
Sleep 40
Send, {enter}
Send, {enter}
Sleep 340
WinMinimize
Sleep 90
Send {Right}
Return

;---------------------------to autocopy 12 urls into notepad

#IfWinActive ahk_group modalsurf2
t::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ Y ] Save 12 URLs, Save Feature Requires an Active Notepad File, 2
Return
}
Loop 11
{
Send, c
Sleep 100
Send, x
Sleep 100
ifWinExist ahk_class Notepad
WinActivate
sleep 248
Send, ^v
Sleep 200
Send, {backspace 37}
Sleep 40
Send, {enter}
Send, {enter}
Sleep 340
WinMinimize
Sleep 90
Send {Right}
sleep 920
}
Send, c
Sleep 100
Send, x
Sleep 100
ifWinExist ahk_class Notepad
WinActivate
sleep 248
Send, ^v
Sleep 200
Send, {backspace 37}
Sleep 40
Send, {enter}
Send, {enter}
Sleep 340
WinMinimize
Sleep 90
Send {Right}
Return

;----------------------------to load url from notepad to browser

#IfWinActive ahk_group modalsurf2
l::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ L ] Load URL, Load Feature Requires an Active Notepad File, 2
Return
}
ifWinExist ahk_class Notepad
WinActivate
sleep 7
Send, +{down}
Sleep 140
Send, ^c
Sleep 180
Send, {down}
Sleep 15
WinMinimize
Sleep 20
Send, v
Return

;------------------------ load next 4 urls from notepad to browser

#IfWinActive ahk_group modalsurf2
n::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ N ] Load 4 URLs, Load Feature Requires an Active Notepad File, 2
Return
}
Loop 3
{
ifWinExist ahk_class Notepad
WinActivate
sleep 7
Send, +{down}
Sleep 140
Send, ^c
Sleep 180
Send, {down}
Sleep 15
WinMinimize
Sleep 20
Send, v
Sleep 1700
}
;----------------------------------
ifWinExist ahk_class Notepad
WinActivate
sleep 7
Send, +{down}
Sleep 140
Send, ^c
Sleep 180
Send, {down}
Sleep 15
WinMinimize
Sleep 20
Send, v
Return

;------------------------ load next 12 urls from notepad to browser

#IfWinActive ahk_group modalsurf2
u::
ifWinNotExist ahk_class Notepad
{
MsgBox 0, Mode-Roll Hotkeys [ U ] Load 12 URLs, Load Feature Requires an Active Notepad File, 2
Return
}
Loop 11
{
ifWinExist ahk_class Notepad
WinActivate
sleep 7
Send, +{down}
Sleep 140
Send, ^c
Sleep 180
Send, {down}
Sleep 15
WinMinimize
Sleep 20
Send, v
Sleep 1700
}
;----------------------------------
ifWinExist ahk_class Notepad
WinActivate
sleep 7
Send, +{down}
Sleep 140
Send, ^c
Sleep 180
Send, {down}
Sleep 15
WinMinimize
Sleep 20
Send, v
Return

;---------------------------notify that notepad must be minimized

#IfWinActive, ahk_class Notepad
s::
f::
t::
MsgBox 0, Mode-Roll Hotkeys Active, To Save Url - Minimize Notepad First, 2
Return

#IfWinActive, ahk_class Notepad
l::
n::
u::
MsgBox 0, Mode-Roll Hotkeys Active, To Load Urls - Minimize Notepad First, 2
Return

;------------------------------------prevent keys when in notepad

#IfWinActive, ahk_class Notepad
Backspace:: Send, {backspace}
Space:: Send, {space}
Enter:: Send, {enter}
Shift:: Send, {shift}
Right:: Send, {right}
Left:: Send, {left}
-:: Send, -

a::
b::
c::
d::
e::
g::
h::
i::
j::
k::
m::
o::
p::
q::
r::
v::
w::
x::
y::
z::
1::
2::
3::
4::
5::
6::
7::
8::
9::
0::
Tab::
Control::
CapsLock::
=::
+::
,::
.::
/::
Numpad1::
Numpad2::
Numpad3::
Numpad4::
Numpad5::
Numpad6::
Numpad7::
Numpad8::
Numpad9::
Numpad0::
MsgBox 0, Mode-Roll Hotkeys Active, Paste Text via NumberPad1 Interface, 2
Return

;------------------------------regulate messagebox

#IfWinActive, Mode-Roll Hotkeys Active
g::
h::
,::
.::
o::
=::
-::
Return

;------------------------------------adjust volume

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
o::
Send {Volume_Mute}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
=::
Send {Volume_Up}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
-::
Send {Volume_Down}
Return

;--------------------------------------change tabs

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
g::
,::
Send ^+{Tab}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
h::
.::
Send ^{Tab}
Return

;--------------------------------------stop all tabs

FarCli() {
sleep, 70
IfWinActive ahk_group modalsurf8
{
CoordMode, Mouse, Screen ; a click to reset drums
ScreenWidth := A_ScreenWidth
ScreenHeight := A_ScreenHeight
RightEdgeOffset := Round(ScreenWidth * 0.9)
BottomEdgeOffset := Round(ScreenHeight * 0.5)

MouseMove, % RightEdgeOffset, % BottomEdgeOffset
Click
sleep, 70
}
}

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
^x::
Numpad5::
^5::
{
Stop := True
Loop 5
{
FarCli()
Send, x
Sleep 70
Send ^{Tab}
Sleep 70
}}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
Numpad4::
^4::
{
Stop := True
Loop 4
{
FarCli()
Send, x
Sleep 70
Send ^{Tab}
Sleep 70
}}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
Numpad3::
^3::
{
Stop := True
Loop 3
{
FarCli()
Send, x
Sleep 70
Send ^{Tab}
Sleep 70
}}
Return

SetTitleMatchMode, 2
#IfWinActive ahk_group modalsurf4
Numpad2::
^2::
{
Stop := True
Loop 2
{
FarCli()
Send, x
Sleep 70
Send ^{Tab}
Sleep 70
}}
Return

;--------------------------------------show BPM

#IfWinActive ahk_group modalsurf8
NumpadMult::
^t::

FTotalValue := Format("{:.2f}", TotalValue)
ToolTip, %spacer% BPM: %FTotalValue% ... MSecs: %WholeTempo% %spacer%, 1456, 230
SetTimer, CloseToolTip, 4000
Return

CloseToolTip:
ToolTip ; Clear the tooltip
SetTimer, CloseToolTip, Off
Return

;-------------------------------------nudge BPM

#IfWinActive ahk_group modalsurf8
NumpadSub::
^-::
If bpmdec < 2
{
bpmdec := 99
bpmval := bpmval - 1
}
Else
bpmdec := bpmdec - 2

TotalValue := bpmval + bpmdec / 100.0
TempoVar := (1000 * 60 / TotalValue) * BPC
FiveSpeed := Floor(TempoVar / 5)
CrudTime := FiveSpeed * 5
WholeTempo := Round(TempoVar)
DiffSet := WholeTempo - CrudTime
Cru1 := 0
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0

if DiffSet = 1
{
Cru1 := 1
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 2
{
Cru1 := 1
Cru2 := 1
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 3
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 0
Cru5 := 0
}
if DiffSet = 4
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 0
}
if DiffSet = 5
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 1
}
FTotalValue := Format("{:.2f}", TotalValue)
ToolTip, %spacer% BPM: %FTotalValue% ... MSecs: %WholeTempo% %spacer%, 1456, 230
SetTimer, CloseToolTip, 1000
Return

;-------------------------------------------------------

#IfWinActive ahk_group modalsurf8
NumpadAdd::
^=::
If bpmdec > 98
{
bpmdec := 01
bpmval := bpmval + 1
}
Else
bpmdec := bpmdec + 2

TotalValue := bpmval + bpmdec / 100.0
TempoVar := (1000 * 60 / TotalValue) * BPC
FiveSpeed := Floor(TempoVar / 5)
CrudTime := FiveSpeed * 5
WholeTempo := Round(TempoVar)
DiffSet := WholeTempo - CrudTime
Cru1 := 0
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0

if DiffSet = 1
{
Cru1 := 1
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 2
{
Cru1 := 1
Cru2 := 1
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 3
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 0
Cru5 := 0
}
if DiffSet = 4
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 0
}
if DiffSet = 5
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 1
}
FTotalValue := Format("{:.2f}", TotalValue)
ToolTip, %spacer% BPM: %FTotalValue% ... MSecs: %WholeTempo% %spacer%, 1456, 230
SetTimer, CloseToolTip, 1000
Return

;--------------------------------------user interface

#IfWinActive, Automatic Chord-Changer Duration
a:: Send, a
b:: Send, b
c:: Send, c
d:: Send, d
e:: Send, e
f:: Send, f
g:: Send, g
h:: Send, h
i:: Send, i
j:: Send, j
k:: Send, k
l:: Send, l
m:: Send, m
n:: Send, n
o:: Send, o
p:: Send, p
q:: Send, q
r:: Send, r
s:: Send, s
t:: Send, t
u:: Send, u
v:: Send, v
w:: Send, w
x:: Send, x
y:: Send, y
z:: Send, z
/:: Send, /
,:: Send, ,
[:: Send, [
]:: Send, ]
Numpad1::
1:: Send, 1
Numpad2::
2:: Send, 2
Numpad3::
3:: Send, 3
Numpad4::
4:: Send, 4
Numpad5::
5:: Send, 5
Numpad6::
6:: Send, 6
Numpad7::
7:: Send, 7
Numpad8::
8:: Send, 8
Numpad9::
9:: Send, 9
Numpad0::
0:: Send, 0
NumpadDot::
.:: Send, .
\:: Send, \
NumpadAdd:: Send, {right}
NumpadSub:: Send, {left}
NumpadDiv:: Send, {tab}
Tab:: Send, {tab}
Del:: Send, {del}
LShift:: Send, {shift}
RShift:: Send, {shift}
Shift:: Send, {shift}
Space:: Send, {space}
Backspace:: Send, {backspace}
Right:: Send, {right}
Left:: Send, {left}
Return

#IfWinActive ahk_group modalsurf8
Numpad1::
^1::

; Previous Values
tempValue := bpmval
tempDecimal := bpmdec
tempBPC := BPC
Stop := True

Gui, Font, s12 ; Sets the font size to 12
Gui, Add, Slider, x20 y20 w200 h30 vbpmval range60-130, 60-130
Gui, Add, Slider, x230 y20 w200 h30 vbpmdec range0-99, 0-99
Gui, Add, Text, x110 y70 w70 h30 Center vTotalValue, % (bpmval + bpmdec/100.0)
GuiControl,, bpmval, %bpmval%
GuiControl,, bpmdec, %bpmdec%

Gui, Add, Slider, x20 y140 w200 h30 vBPC range4-16, 4-16
Gui, Add, Text, x260 y140 w200 h30 Left vBPCValue, BPC: %BPC%
GuiControl,, BPC, %BPC%
Gui, Add, Text, x60 y70 w50 h30 Center, BPM:
Gui, Add, Text, x250 y70 w80 h30 Center, MSecs:
Gui, Add, Text, x330 y70 w80 h30 Center vWholeTempo, WholeTempo: %WholeTempo%
Gui, Add, Button, x20 y200 w100 h30 gCancelBtn, Cancel
Gui, Add, Button, x180 y200 w90 h30 gCopyBtn, Copy
Gui, Add, Button, x333 y200 w100 h30 gOkBtn, OK

; "A" button
Gui, Add, Button, x33 y260 w34 h30 gAbtn, A
Gui, Add, Button, x83 y260 w34 h30 gBbtn, B
Gui, Add, Button, x133 y260 w34 h30 gCbtn, C
Gui, Add, Button, x183 y260 w34 h30 gDbtn, D
Gui, Add, Button, x233 y260 w34 h30 gEbtn, E
Gui, Add, Button, x283 y260 w34 h30 gFbtn, F
Gui, Add, Button, x333 y260 w34 h30 gGbtn, G
Gui, Add, Button, x383 y260 w34 h30 gHbtn, H

; "I" button
Gui, Add, Button, x33 y305 w34 h30 gIbtn, I
Gui, Add, Button, x83 y305 w34 h30 gJbtn, J
Gui, Add, Button, x133 y305 w34 h30 gKbtn, K
Gui, Add, Button, x183 y305 w34 h30 gLbtn, L
Gui, Add, Button, x233 y305 w34 h30 gMbtn, M
Gui, Add, Button, x283 y305 w34 h30 gNbtn, N
Gui, Add, Button, x333 y305 w34 h30 gObtn, O
Gui, Add, Button, x383 y305 w34 h30 gPbtn, P

; "Q" button
Gui, Add, Button, x33 y350 w34 h30 gQbtn, Q
Gui, Add, Button, x83 y350 w34 h30 gRbtn, R
Gui, Add, Button, x133 y350 w34 h30 gSbtn, S
Gui, Add, Button, x183 y350 w34 h30 gTbtn, T
Gui, Add, Button, x233 y350 w34 h30 gUbtn, U
Gui, Add, Button, x283 y350 w34 h30 gVbtn, V
Gui, Add, Button, x333 y350 w34 h30 gWbtn, W
Gui, Add, Button, x383 y350 w34 h30 gYbtn, Y

; Single-line textbox
Gui, Add, Edit, x20 y400 w300 h28 vTextToCopy Limit70
Gui, Add, Button, x330 y400 w100 h30 gTextCopyBtn, Copy

;--------------------------------------------------------------------

Gui, +Alwaysontop
Gui, Show, w453 h460, Automatic Chord-Changer Duration
SetTimer, UpdateSliderText, 50
return

#IfWinActive ahk_class AutoHotkeyGUI
^c::
TextCopyBtn:
GuiControlGet, TextToCopy
Clipboard := TextToCopy
return

CopyBtn:
FTotalValue := Format("{:.2f}", TotalValue)
Clipboard := "------- BPM: " . FTotalValue . " ----- BPC: " . BPC . " -------"
return

GuiClose:
CancelBtn:
bpmval := tempValue
bpmdec := tempDecimal
BPC := tempBPC
Gui, Destroy ; Close the GUI
return

#IfWinActive ahk_class AutoHotkeyGUI
Enter::
NumpadEnter::
OkBtn:
GuiControlGet, bpmval
GuiControlGet, bpmdec
GuiControlGet, BPC
Gui, Submit ; Submit the values
Gui, Destroy ; Close the GUI

Cru1 := 0
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0

if DiffSet = 1
{
Cru1 := 1
Cru2 := 0
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 2
{
Cru1 := 1
Cru2 := 1
Cru3 := 0
Cru4 := 0
Cru5 := 0
}
if DiffSet = 3
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 0
Cru5 := 0
}
if DiffSet = 4
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 0
}
if DiffSet = 5
{
Cru1 := 1
Cru2 := 1
Cru3 := 1
Cru4 := 1
Cru5 := 1
}

ifWinExist ahk_group modalsurf2
WinActivate
return

UpdateSliderText:
GuiControlGet, bpmval
GuiControlGet, bpmdec
TotalValue := bpmval + bpmdec / 100.0
GuiControl,, TotalValue, % Format("{:.2f}", TotalValue)

GuiControlGet, BPC
GuiControl,, BPCValue, Beats Per Chord: %BPC%

TempoVar := (1000 * 60 / TotalValue) * BPC
GuiControl,, TempoVar, % Format("{:.2f}", TempoVar)

FiveSpeed := Floor(TempoVar / 5)
GuiControl,, FiveSpeed, %FiveSpeed%

CrudTime := FiveSpeed * 5
GuiControl,, CrudTime, %CrudTime%

WholeTempo := Round(TempoVar)
GuiControl,, WholeTempo, %WholeTempo%

DiffSet := WholeTempo - CrudTime
GuiControl,, DiffSet, %DiffSet%
return

;------------------------control the duration-player

#IfWinActive ahk_group modalsurf2
Numpad8::
NumpadDot::
^8::
Stop := True
pumped := 0
ToolTip, %spaces% Player Stop %spaces%, 1500, 230
SetTimer, CloseToolTip, 600
Return

#IfWinActive ahk_group modalsurf2
Numpad9::
NumpadEnter::
^9::

If FiveSpeed < 100
{
Stop := True
MsgBox 0, Duration Player, Min. Duration 2 Seconds, 1
}
Else
Stop := False
Loop 200 ; many times
{
If Stop
Break
Else
Pasi := 1
IfWinActive ahk_group modalsurf2
Send {Right}
Loop 5
{
If Stop
Break
Else
{
If Pasi = 1
{
Sleep (FiveSpeed + Cru1)
Pasi := 2
}
Else if Pasi = 2
{
Sleep (FiveSpeed + Cru2)
Pasi := 3
}
Else if Pasi = 3
{
Sleep (FiveSpeed + Cru3)
Pasi := 4
}
Else if Pasi = 4
{
Sleep (FiveSpeed + Cru4)
Pasi := 5
}
Else if Pasi = 5
{
If pumped = 0
Sleep (FiveSpeed + Cru5)
else
{
Sleep (FiveSpeed + pumped + Cru5)
pumped := 0
}
}
}
}
}
Return

#IfWinActive ahk_group modalsurf8
Numpad0::
^0::
If Stop
return
Else
{
pumped := pumped - 15
ToolTip, %spaces% Pumped: %pumped% %spaces%, 1500, 230
SetTimer, CloseToolTip, 1000
}
Return

#IfWinActive ahk_group modalsurf8
Numpad7::
^7::
If Stop
return
Else
{
pumped := pumped + 15
ToolTip, %spaces% Pumped: %pumped% %spaces%, 1500, 230
SetTimer, CloseToolTip, 1000
}
Return

;--------------------------------negate up & down arrows

#IfWinActive ahk_group modalsurf0
down::
up::
Return

;------------------notify used buttons if not in browser

SetTitleMatchMode, 2
#IfWinNotActive ahk_group modalsurf4
a::
b::
c::
d::
e::
f::
g::
h::
i::
j::
k::
l::
m::
n::
o::
p::
q::
r::
s::
t::
u::
v::
w::
x::
y::
z::
1::
2::
3::
4::
5::
6::
7::
8::
9::
0::
Tab::
Space::
LShift::
RShift::
Control::
Backspace::
CapsLock::
-::
=::
+::
,::
.::
/::
Numpad1::
Numpad2::
Numpad3::
Numpad4::
Numpad5::
Numpad6::
Numpad7::
Numpad8::
Numpad9::
Numpad0::
Right::
Left::
Alt::

MsgBox 0, Mode-Roll Hotkeys Active, Press Escape to Quit Hotkeys, 2
Return