Professional Documents
Culture Documents
Raphael Menezes
raphaelm@gmail.com
Listen Share
Roblox Studio comes with autocomplete (which doesn’t work sometimes), but it
doesn’t have code templates. But fear not, you can create your own code templates
using text expanders.
The ultimate automation scripting language for Windows. AutoHotkey is a free, open-
source scripting language for Windows that allows users to easily create small to complex
scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.
As a programmer myself, I’ve been using it practically since its launch in 2004 and I
can say that I can’t live without it.
Open Notepad or any other text editor and create a new file.
One of the most common lines in Roblox scripts is: local parent = script.Parent or
normally declared as local sp= script.Parent. How to create a template for this line?
:*:xsp::local sp = script.Parent`n
Save the file and save it as roblox-templates.ahk. Double click to open it and execute
AutoHotkey in the background. You can see the file running in the AutoHotkey icon
in the system tray. You can pause and suspend the hotkeys anytime by right clicking
the icon.
Also anytime that you modify your .ahk file, you have to click “Reload This Script”
over there.
Of course you can modify the abbreviation to anything that you want, such as /sp,
localsp, scriptparent, etc.
:*:xwfc:::WaitForChild(""){left 2}
How to Replace an Abbreviation if you are Already Inside Another Word?
If you tried the above example exactly in the way that I did, it probably didn’t work
for you, because spxwfc was typed and not xwfc. When you use :*, AutoHotkey
expects the abbreviation by itself, standalone.
To make it work inside an existing word, like the above example, add a ? after :*.
Example:
:*?:xwfc:::WaitForChild(""){left 2}
First, run AutoHotkey Window Spy to grab the application name: right click the
system tray icon -> Window Spy -> make Roblox Studio the active program and then
copy the line ahk_exe [Something], like I show here:
Now, in your .ahk script, place your templates inside a #IfWinActive return clause:
Reload AutoHotkey (right click system tray -> reload this script) and you are ready to
go!
Additional Tips
Raw Templates
If your template has characters that conflict with AutoHotkey’s commands and
syntax, you can place them inside curly braces, specially colon (:). Example:
:*:xeq::tool.Equipped{:}connnect(){left}
Multi-Line Templates
You can use `n , {Enter} or Continuation Sections.
Sample Templates
But is it Safe?
If you are worried about AutoHotkey being a safe piece of software, check the
following links. The community speaks for itself.
AutoHotkey - Wikipedia
AutoHotkey is a free, open-source custom scripting language for
Microsoft Windows, initially aimed at providing easy…
en.wikipedia.org
https://autohotkey.com/boards/
A Google search returns 3.8 million results, mostly tutorials, documentations and so
on:
https://www.google.com.br/search?q=autohotkey&oq=autoh&ie=UTF-8
Follow
Written by SplitPainter
9 Followers · Editor for ROBLOX Academy
A software engineer and startup owner w/ 22 years of experience. Creating 3 #Roblox Games #robloxdev
#rbxdev I also paint traditionally. Roblox: SplitPainter
13
30K 527
Love Sharma in ByteByteGo System Design Alliance
6.9K 53
Lists
8.2K 82
5.8K 119
17.8K 283
Dr. Derek Austin 🥳 in Better Programming
1.2K 54