I'm sharing some Autohotkey scripts I've made to help speed up my work with Fusion. You'll need Please login to see this link.installed to use these (it's easy to set up). Then you just add some/all of the following snippets of code as you wish, and they'll work while your Autohotkey .AHK file is running. Please note that I'm not an expert at the Autohotkey scripting language (I actually can't stand syntax-based programming - having to write code for Autohotkey made me realise just how much I love Fusion!), so some of these may have room for improvement. If something's not working for you, I wouldn't be of much help so you'll need to figure it out yourself, sorry. But please feel free to post any improvements to these scripts, or other scripts you use.
The hotkeys that these use are easy to change. Look for the bits near the top of each snippet with a double colon after them. For example, one of the snippets uses alt-leftarrow for its hotkey (!left::). You could change that to alt-ctrl-rightarrow (!^right::) or win-shift-Q (#+q::) or shift+ctrl+win+middleMouseButton (+^#MButton::) or to the "next track" button on your multimedia keyboard (Media_Next::). There's a full reference of possibilities on the Please login to see this link.. Most of these snippets are pretty short, though a couple of them are a bit messier. Here's a list of the functions - all their code/notes/gifs are lower down.
- Type cl\ to automatically type Clickteam
- Make Ctrl-F do Find All instead of Find
- hotkey to jump directly to Search field
- alt-left/alt-right to jump through 'parameters' in the expression editor
- Ctrl-`(tilde) to separate out code for easier reading
- `(tilde) to Auto-format code
- Ctrl-Shift-middleclick titlebar of a Fusion window (eg. event editor) to move it to a preset position. Ctrl-Alt-middeclick it to move to a different preset position
- Hotkey to move Fusion's various toolbar windows to where you like them
- Ctrl-Shift-D to toggle debugger window while in runtime
Hope some of you find these useful!
Type cl\ to automatically type Clickteam
This works everywhere (eg. the forums). Type C then L then Backslash and it'll instantly turn into "Clickteam ".
Make Ctrl-F do Find All instead of Find
Once you start using the newer :cf25+: Find All feature you'll probably never go back to the older one. So this lets you use the new one with the trusty Ctrl-F hotkey.
F14 to jump directly to Search field
Go to the search-as-you-type field without taking your hands off the keyboard (or having to tab through all the way to it).
This one works with various searchable windows, like expression editor, create new object (frame editor), and create object (event editors) windows.
(I have a keycap with a loupe on it on my keyboard, mapped to F14 - obviously you can use a different hotkey)
Please login to see this picture.
#IfWinActive ahk_exe mmf2u.exe ahk_class #32770 ;the following code only runs while the EXPRESSION EDITOR (or other Fusion child windows) is active
F14:: ; ⸻⸻⸻⸻ go to Search-As-You-Type field
ControlFocus, Edit1
sendinput ^a
return
#IfWinActive
alt-left/right to jump through 'parameters' in the expression editor
"Parameters" is the wrong word, but I wasn't sure what to call it. This tries to find all the single-word (no spaces) snippets in your code that are either toTheLeft("of a bracket") or that are ("inside double quotes and brackets").
It works ok though sometimes can glitch out a little.
#IfWinActive ahk_exe mmf2u.exe ahk_class #32770 ;the following code only runs while the EXPRESSION EDITOR is active
{ ;;; --------------jump to NEXT PARAMETER ---
!right::
sendinput {right 2} ;position cursor ahead of any current selection
sleep 30
{ ;;; ; admin
ControlGetFocus, activeControlVar, A
ControlGetText, windowText, %activeControlVar%, A
counter := 1
vSnippetPosition := []
VarSetCapacity(vCaretPosition, 4, 0)
SendMessage, 0x00B0,, &vCaretPosition,%activeControlVar%, A
vCaretPosition := NumGet(vCaretPosition)
} ;;; end admin
Loop ;PARSE text and record found snippet positions
{
cleanedWindowText := regexreplace(windowText,"im)`r`n"," ") ;convert line breaks into single characters or it gets confused
RegExMatch(cleanedWindowText, "O)\(|""\s\)", delimiter, counter) ; searches for (
counter := delimiter.Pos + delimiter.Len
if (delimiter.Value = "" )
break
vSnippetPosition.Push(delimiter.Pos)
}
Loop ;PICK next snippet from caret position
{
If (vCaretPosition < vSnippetPosition[A_Index])
{ ;select NEXT snippet
vSelectionPosition := vSnippetPosition[A_Index] -1
break
}
Else If (vSnippetPosition[A_Index] = "") ;if no more snippets found
{
break
}
}
;SELECT correct snippet. (SendMessage 0xB1 is EM_SETSEL, which highlights )
SendMessage, 0xB1,%vSelectionPosition% ,%vSelectionPosition% , %activeControlVar%, A
sendinput {left}^{left}^+{right} ; select phrase before current snippet
Return
} ;;; end ---- next parameter
{ ;;; ------------------ jump to PREV PARAMETER ---
!left::
sendinput {left 2} ;position cursor ahead of any current selection
sleep 30
{ ;;; ; admin
ControlGetFocus, activeControlVar, A
ControlGetText, windowText, %activeControlVar%, A
counter := 1
vSnippetPosition := []
VarSetCapacity(vCaretPosition, 4, 0)
SendMessage, 0x00B0,, &vCaretPosition,%activeControlVar%, A
vCaretPosition := NumGet(vCaretPosition)
} ;;; end admin
Loop ;PARSE text and record found snippet positions
{
cleanedWindowText := regexreplace(windowText,"im)`r`n"," ") ;convert line breaks into single characters or it gets confused
RegExMatch(cleanedWindowText, "O)\(|""\s\)", delimiter, counter) ; searches for (
counter := delimiter.Pos + delimiter.Len
if (delimiter.Value = "" )
break
vSnippetPosition.Push(delimiter.Pos)
}
Loop ;PICK next snippet from caret position
{
If (vCaretPosition < vSnippetPosition[A_Index])
{ ;select PREV snippet
vSelectionPosition := vSnippetPosition[A_Index-1] -1
break
}
Else If (vSnippetPosition[A_Index] = "") ;if no more snippets found
{
vSelectionPosition := vSnippetPosition[A_Index-1] -1
break
}
}
;SELECT correct snippet. (SendMessage 0xB1 is EM_SETSEL, which highlights )
SendMessage, 0xB1,%vSelectionPosition% ,%vSelectionPosition% , %activeControlVar%, A
sendinput {left}^{left}^+{right} ; select phrase before current snippet
Return
} ;;; end --- prev parameter
#IfWinActive
Display More
Ctrl-`(tilde) to separate out code for easier reading
Definitely not perfect, but can be useful. Basically finds every closing bracket and inserts a line break after it with ctrl-enter.
Please login to see this picture.
#IfWinActive ahk_exe mmf2u.exe ahk_class #32770 ;the following code only runs while the EXPRESSION EDITOR is active
^`::
vNewChars := 0
{ ;;; ; admin
ControlGetFocus, activeControlVar, A
ControlGetText, windowText, %activeControlVar%, A
counter := 1
vSnippetPosition := []
} ;;; end admin
Loop ;PARSE text and record found snippet positions
{
cleanedWindowText := regexreplace(windowText,"im)`r`n"," ") ;convert line breaks into single characters or it gets confused
RegExMatch(cleanedWindowText, "O)\)", delimiter, counter) ; searches for )
counter := delimiter.Pos + delimiter.Len
if (delimiter.Value = "" )
break
vSnippetPosition.Push(delimiter.Pos)
}
;go through each snippet and press ctrl-enter after each one
Loop
{
vSelectionPosition := vSnippetPosition[A_Index]
SendMessage, 0xB1,%vSelectionPosition% ,%vSelectionPosition% , %activeControlVar%, A
sendinput {right %vNewChars%} ^{enter}
sleep 100
vNewChars := vNewChars +2
If (vSnippetPosition[A_Index+2] = "") ;if no more snippets found
{
break
}
}
Return
#IfWinActive
Display More
`(tilde) to Auto-format code
this one just simulates clicking the button so you can do it without taking your hands of the keyboard
Please login to see this picture.
#IfWinActive ahk_exe mmf2u.exe ahk_class #32770 ;the following code only runs while the EXPRESSION EDITOR is active
{ ;;; ⸻⸻⸻⸻ AUTOFORMAT CODE
`::
; ⸻⸻⸻if it's an EDIT GROUP dialog, just send regular keystroke
if WinActive("Group Events") {
sendinput ``
return
}
else {
;⸻⸻⸻record current mouse position
mousegetpos, origX, origY
; ⸻⸻⸻determine what the window is and determine the button position accordingly
if WinActive("Set Y") {
click 160,82
} else
if WinActive("Set X") {
click 160,82
} else
if WinActive("Set") {
click 160,125
} else
if WinActive("Add to") {
click 160,125
} else
if WinActive("Subtract from") {
click 160,125
} else {
click 160, 82 ; click on format button
}
; ⸻⸻⸻⸻ restore original mouse position after short delay
sleep 50
mousemove %origX%, %origY%
return
}
} ;;; end autoformat code
#IfWinActive
Display More
Ctrl-Shift-middleclick titlebar of a Fusion window (eg. event editor) to move it to a preset position. Ctrl-Alt-middeclick it to move to a different preset position
This is particularly useful for multimonitor setups. Format is X, Y, Width, Height
{ ;;;; ⸻⸻⸻⸻ move/resize an ACTIVE Fusion CHILD window (eg. the Event Editor).
#IfWinActive ahk_exe mmf2u.exe
+^MButton::
MouseGetPos, , , id, varControlID,3
WinMove, ahk_id %varControlID%,, 284,-11,1884,1365
return
+!MButton::
MouseGetPos, , , id, varControlID,3
WinMove, ahk_id %varControlID%,,2549,-11,1080,1845
return
#IfWinActive
} ;;;
Display More
Shift-Ctrl-F15 to move Fusion's various toolbar windows to where you like them
Yes, you'll want to change the hotkey for this one. Format is X, Y, Width, Height
+^F15::
; move the panel windows into correct positions.
WinMove, ahk_exe mmf2u.exe,Workspace Toolbar, -284,0,285,1440
WinMove, ahk_exe mmf2u.exe,Properties, 0,57,297,1363
WinMove, ahk_exe mmf2u.exe,Find, -900,0,616,1440
WinMove, ahk_exe mmf2u.exe,Layers Toolbar, 2291, 0, 270,1411
WinMove, ahk_exe mmf2u.exe,Event explorer, 2291, 0, 270,1411
WinMove, ahk_exe mmf2u.exe,Library Toolbar, 2560, 110, 1080, 1000
return
Ctrl-Shift-D to toggle debugger window while in runtime
This lets you turn it off and on without your game losing window focus
#IfWinActive ahk_exe edrt.exe
; ⸻⸻⸻⸻ toggle native DEBUGGER
^+d::
{
nativeDebuggerToggle := !nativeDebuggerToggle
While (nativeDebuggerToggle=1) {
WinHide, ahk_class #32770 ahk_exe edrt.exe,
return
}
While (nativeDebuggerToggle=0) {
WinShow, ahk_class #32770 ahk_exe edrt.exe,
return
}
return
}
#IfWinActive
Display More