• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey

AutoHotkey Webinar- Intro to AutoHotkey

webnar 300x200In this webinar we cover an Intro to AutoHotkey.

Video Hour 1: High-level overview: Hour 1
Video Hour 2: Q&A: Hour 2

Script Highlight: Minimize to tray–  This is an “old” AutoHotkey script but is super-cool!   When running you simply press the Windows Key & H and the active program will “disappear”.  It works on multiple windows.  Then, when you want them back, press Windows & U and the windows will be visible again.

Intro to AutoHotkey

  • AutoHotkey is free, open-source, Windows scripting language
  • Created in 2003 from Chris Mallet it was an off-shoot of AutoIt
  • AHK is user-friendly for non-programmers but is also used by programmers as it “hooks” into Windows & windows programs very well
  • The core language is very descriptive and typically isn’t too hard to grasp
  • Scripts are easily “compiled” into an executable which can be easily shared
  • You do not need to install AutoHotkey to run it. (It can be run from a thumb-drive)

What can AutoHotkey do?

You can automate virtually anything on a Windows computer!  Here are some uses:

  • HotStrings: think text expansion on your phone or spell-check in MS Word
  • HotKeys: Launch programs with a click of a button
  • Files & Folders: Manipulate, read, move, delete etc.
  • Automate programs : Outlook, Word, Excel, SPSS, VLC, Adobe, etc.
  • Connect to Windows API: Programmatically affect Windows & other programs
  • Web Scrape: Reliably download data from webpages &/or manipulate /complete forms
  • Web Service APIs: Many vendors allow you to query their services
  • Create GUIs: Simplify interacting with scripts by creating a GUI to manipulate
  • Regular Expressions: use pattern matching on text files to extract or re-arrange the text
  • Audio & Image Manipulation: Screen clipping, OCR, extract audio, Video recording, etc.
  • So much more!!!

AutoHotkey Resources

Installation of AutoHotkey

Go here and download the current version of AutoHotkey https://www.autohotkey.com/download/

During installation, we recommend installing the Unicode 32-bit version of AutoHotkey

Installing a Default AutoHotkey Editor

AutoHotkey code is “plain text” and pretty easy to read

Having said that, using an editor / IDE, instead of notepad, is very helpful!

Below are links to the three most popular AHK editors.  Are all equally good as are many others).  For our demonstration we are going to use SciTE (pronounced ‘sight’)

  • SciTE4AutoHotkey  is a great editor for AutoHotkey.  Here are a bunch of videos demonstrating how to Customize SciTE
  • AutoHotkey Studio  Great editor specific to AutoHotkey.  Check out the demo in this webinar
  • Notepad ++  Another great editor which is customized for working with AutoHotkey

Before Your First AutoHotkey Script

Before we start coding, here are some basics which will help you

  1. #SingleInstance, Force: Put in all scripts. This Forces 1 instance of the script
  2. The Green icon with white H   in system tray shows you the script is running
  3. Every time you make changes to your script, you need to Reload / Launch it for the changes to take affect
  4. Frequent Modifier keys (for HotKeys) are: ^=Control #=Windows +=Shift  !=Alt
  5. Frequent Special Characters (for HotStrings) are:#,!,+,;  Wrap them with {}
    1. For a New Line, use `n, for a tab use `t

 

Your First AutoHotkey Script

Hotkey

Copy & Paste to Excel

Troubleshooting & Debugging

  • Watch our AutoHotkey webinar on Troubleshooting & Debugging (or join a future webinar and ask questions in the second hour)
  • Work through our HotStrings Udemy course
  • Is script running / Green icon with white H in system tray
  • If Green H Icon, Restart script
  • Double-click icon & look at: last lines run, Variables & their contents, Hotkeys & their methods, Key history
  • Close all other scripts & programs & retry
  • If still not working, start using msgbox to “walk through” the script
  • Try using ListVars & ListLines
  • Read documentation on specific command/function you’re having issue on. Search forum/StackOverflow for examples
  • Try running your script as Admin
  • Temporarily turn-off UAC (User Account Control)
  • Is your issue after the Auto-Execute Section?
  • If Context-sensitive, remove context sensitivity & run general
  • Reboot the computer (hey, it’s Windows…)
  • Search the AutoHotkey Forum, Stack Overflow for similar issues
  • Is the problem consistent & repeatable?
  • Does it happen on other computers?
  • What, specifically, isn’t working? Break down the part that isn’t working into it’s-own script. Provide specific example to AHK Forum, StackOverflow, or friend after spending at least 30 minutes on it yourself. You can also check Discord for live feedback/support.
  • For SciTE debugging, you can check out videos on this post

 

AutoHotkey webinar: Deep-Dive into File Encoding

AutoHotkey Bottle 3In this AutoHotkey Webinar took a deep-dive into File Encoding by our guest speaker Jean Lalonde (author of Quick Access Popup)

Video Hour 1:  High Level:

  • Why File encoding matters
  • Pros/Cons of each type of encoding
  • Tools like the File Encoding Lab to help determine a file’s encoding
  • How to set File Encoding in AutoHotkey

Video Hour 2: Coding and Q&A

Script Highlight: BarChart by Learning One

barchart

(Here is a link to BarChart scripts demonstrated during the webinar)


1) File Enconding in AutoHotkey

(Here is a link to all of Jean Lalonde’s files)
  • Edit and run the AHK script “FileRead.ahk”
  • Load “Demo-UTF-16.txt” with default encoding
  • Load “Demo-UTF-16-No_BOM.txt” with default encoding  -> problem!
  • Load “Demo-UTF-16-No_BOM.txt” with UTF-16-RAW encoding  -> OK!
  • Try the other file enconding available in AHK

2) File Encoding in DOS (code pages)

  • Run the batch file “Type Box.bat” in DOS console (under “Tutorial“ folder)
  • See this ASCII/ANSI file displayed with code pages 1252 (default ASCI/ANSI) and 437

3) Load the File Encoding Lab

  • Run the AHK script “File Encoding Lab.ahk”
  • Loaded bu default “ASCII.txt” (detected CP1252, 7-bit chars)
  • File Encoding Lab tour
    • Binary display on the left side / Normal AHK display on the right
    • Click on the file name to see with Notepad
    • Encoded detected and use the dropdown list to reload with another encoding
  • Load “ANSI.txt” (detected CP1252, 8-bit chars)
  • Load “Box-CP437.txt” (detected CP1252, 8-bit chars)
    • Which encoding will display a box?
  • Load “UTF-8.txt” (detected UTF-8)
    • see BOM (“byte ordre mark” or header) on left side: two first bytes
    • See one byte for “!”
    • See two bytes each for “é”  and “É«
    • See three bytes for “用”

AutoHotkey Merchandise-White Stress ball

4) File Encoding Lab Cheat Sheet

  • ASCII and ANSI
  • Unicode 8-16-32 bits
  • Unicode with/without BOM
  • Unicode Little or Big Endian

5) Real life files

  • QAP Spanish translation
  • QAP Chinese translation
  • Other examples?

Webinar- SciTE4AutoHotkey is an amazing editor!

SciTE4AutoHotKey

In this AutoHotkey Webinar we cover using/customizing  SciTE4AutoHotkey by FincsSciTE webinar

Video Hour 1High-level overview:

SciTE4AutoHotkey is a lightweight and easy to use SciTE-basedAutoHotkey script editor. It provides:

Demonstration of cool SciTE4AutoHotkey features

  1. Multi-line typing
  2. Dynamic Intellisense
  3. Move text up/down
  4. Comment / Un-comment
  5. Change applied Intellisense language
  6. Copy / Paste as RTF
  7. Custom Context Menu
  8. Search / Replace – with RegEx
  9. List of Extensions to “open”
  10. Highlight multiple instances of each word
  11. Change color of highlighting for found word
  12. Custom Status bar
  13. Configure hotkeys (w/o AutoHotkey)
  14. Custom your Status bar
  15. Setting default magnification level
  16. Import additional languages (here are an additional ~70 languages)
  17. Leverage the Output area as a GUI
  18. Customizing your context menu
  19. Running multiple instances of SciTE
  20. Debug your scripts
  21. Run selected text

Scripts / External Resources

  1. Main thread on SciTE4AutoHotkey
  2. 16 videos @ the-Automator on using / customizing SciTE
  3. 42 of built-in Hotkeys
  4. My SciTE User.properties file (backup yours before playing with it!)
  5. Adding Intellisense for an additional ~70 languages
  6. Scintilla / SciTE Documentation, Interface, Menu /Key commands
  7. UserGroup plus StackOverflow
  8. Second SciTE window by boiler (launch script, then do new window)
  9. Tweaking Intellisense to use your file / library from XeroByte
  10. Have Intellisense examine current file from lexikos

Video Hour 2Discussion and Q&A

White sticker on computer 4Script Highlight: Button Clock

Why waste space for “Start” button.   Use Button_Clock_WINXP from Goyyah

How to Customize SciTE Status bar: Create your own to your liking with this simple hack in 2021

scite status barHere I show you how to customize SciTE status bar.  This  is a great, easy, way to add more relevant information to your needs.

In the below video I walk through how you can make minor tweaks to your status bar by editing your user.properties file.  Further down the page I’ve provided some of the built-in variables however there are a ton of additional ones you can check out the defined variables here.

Here is the syntax I walked through in the below video.  The first SciTE statusbar.text.1 that is commented out is one I use by default.

SciTE4AutoHotkey Status Bar customization video

Built-in variables for SciTE status bar

Variable Name Meaning
FilePath full path of the current file
FileDir directory of the current file without a trailing slash
FileName base name of the current file
FileExt extension of the current file
FileNameExt $(FileName).$(FileExt)
Language name of the lexer used for the current file
SessionPath full path of the current session
CurrentSelection value of the currently selected text
CurrentWord value of word which the caret is within or near
Replacements number of replacements made by last Replace command
SelectionStartColumn column where selection starts
SelectionStartLine line where selection starts
SelectionEndColumn column where selection ends
SelectionEndLine line where selection ends
CurrentMessage most recently selected output pane message
SciteDefaultHome directory in which the Global Options file is found
SciteUserHome directory in which the User Options file is found
SciteDirectoryHome directory in which the Directory Options file is found
APIPath list of full paths of API files from api.filepattern
AbbrevPath full path of abbreviations file
ScaleFactor the screen’s scaling factor with a default value of 100
  • Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey