Tuesday, 2025-07-01, 10:14 PM
Welcome Guest

Blog

Main » 2011 » March » 27 » Create a Simple Hotkey and HotString
4:39 PM
Create a Simple Hotkey and HotString
Hello guys. I am here to teach you how to create a simple hotkey using AutoHotkey programming language.

What is AutoHotkey?
AutoHotkey is a free, open source macro-creation and automation software utility which allows users to automate repetitive tasks. Any application user interface can be modified by AutoHotkey (for example, with Emacs style). It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hotkeys.

What are Hotkeys?
Hotkeys are sometimes referred to as shortcut keys because of their ability to easily trigger an action (such as launching a program or keyboard macro).

Now you know what is AutoHotkey and Hotkey, lets have an example.

Example:
First, create a new AutoHotkey Script file and edit it using notepad, SciTE for AutoHotkey, or any text editor programs possible.

Lets say you want to write your name, for example, "GarenaZero", in every post you make. Also you want it to look like this, "- GarenaZero". It is time consuming and uses few key presses. With the help of AutoHotkey, we will make it simpler.

Syntax:

Code
Hotkey:: Send, YourMessage

Hotkey = the key(s) to be pressed to activate the code
YourMessage= the message you want to show

Lets say your desired hotkey is Alt+G. This will be the code looks like.

Code
!G:: Send, - GarenaZero

"!", without quotes is used for Alt or you can use the word "Alt" itself instead of "!" but the syntax will change from "!G::- GarenaZero" to "Alt & G:: Send,- GarenaZero".

Hotstring:
If you like just to type "-gz" or any string you want to. Here is the way to do it.

Syntax:

Code
::YourString::YourMessage

YourString = the string you want to type instead of typing every single letter
YourMessage= the message you want to show

Here is the code looks like.

Code
::-gz::- Garena Zero

You have to press Enter key or Space Bar to execute the code.

I wish you learn something here. Happy programming.

Views: 1739 | Added by: GarenaZero | Tags: hotstring, hotkey, Михаил Круг | Rating: 5.0/1
Total comments: 0
Name *:
Email *:
Code *: