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

AutoHotkey Webinar 10/2021: Creating and Using AutoHotkey Functions

AutoHotkey webinar AutoHotkey functionsHour 1: Intro to Functions

Hour 2: Q&A Styles and helping Attendees

Script Highlight:  Times around the world by jeeswg

The Automators’ Podcast 

#113: 7 reasons to talk to others about your programming
#114: 5 tips how to reduce the amount of personal support you provide
#115: What is an idea worth? How much $ should you pay the “idea person”?

Resources presented in Webinar

What is a Function?

  • A function is similar to a subroutine (Gosub) except that it can accept parameters (inputs) from its caller.
  • In addition, a function may optionally return a value/values to its caller.

66 Built-in AHK Functions https://www.autohotkey.com/docs/Functions.htm#BuiltIn

  • Polythene’s Command functions https://github.com/Paris/AutoHotkey-Scripts/blob/master/Functions.ahk
  • jeeswg commands as functions (AHK v2 functions for v1) https://www.autohotkey.com/boards/viewtopic.php?f=37&t=29689

Some main benefits of Functions

  • They can be used without storing value
  • You can have multiple on one line / nest
  • Scope is limited (both a blessing and a curse)
  • You create functions to “wrap” complex code which greatly simplifies it’s usage
  • Via a DLL call you can leverage TONS of functions outside AutoHotkey!
  • Variadic functions take a “variable” number of parameters

Built-in AutoHotkey functions

  • Using built-in Functions (here are a couple examples)
  • SubStr(String, StartingPos [, Length])
  • Round(Number[,N])
  • Trim()
  • StrSplit(String , [Delimiters, OmitChars, MaxParts])

Highlights:

  • Positional parameters (the order matters they’re not named parameters)
  • Required parameters
  • Optional parameters

Creating your own Functions in AutoHotkey

  • Why you want to create them
  • Defining a Function verse Calling a function
  • Working with SCOPE
  • Global
  • Static
  • byRef

What we’ll cover:

  • Accessing variables outside your AutoHotkey function
  • Passing parameters
  • Setting default values for your parameters
  • Returning value
  • Returning more than 1 value (byRef & Objects/Arrays)
  • Using the #Includes directive and Function Libraries

Biggest things that will trip you up!

  • Scope seems like a design flaw however it is a great benefit. Most noobs (and even seasoned programmers) will sometimes forget they are inside a function and try and access a variable outside the function
  • Forgetting you returned an object and trying to access it as a variable
  • Making something Global and then reusing the variable in something else

Skins & Styles – Dimitri  (I’ll work on a working example to include here)

Dimitri Geertz joined the webinar and demonstrated his work using the skinsUSkin.dll.

You can learn more about it here in the forum post

or this post from CodeProject

I made this video which shows how simple it can be.  You can download the script below

AutoHotkey Webinar: AutoHotkey Version 2 – What to look out for when switching to V2

In this webinar we explore some of the main differences in AutoHotkey version 2, Why you might adapt it, and a tool to help automate the adaption

Special thanks to Dimitri Geerts for leading the discussion, putting together the deck, and working on the converter tool!

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

  • Major differences withAHK Version 2
  • You can read up on the official listing of changes
  • v2.0 beta 1was released in July 2021 and future releases are expected to be backward-compatible!  If you want to learn more, check out the v2 forum posts:
  • Take a look at the tool Dimitri demonstrated to adapt V1 code to V2 here

 

Script Highlight:  RunWith: Use this function to control the bitness of your AutoHotkey script

Sign up for future webinars here

See past AutoHotkey webinars 

You can get the Deck Dimitri presented here, or just look through the below images.

1) All parameters are expressions, not text

1 Paramaters are expressions 1

2) Variables need to be declared

2 Variables need to be declared

3) “All” commands are now also functions

3 All commands are also now functions 1

4) Some functions now return objects

4 Some functions return objects

5) There is now a distinction between properties accessed with . and data (items, array or map elements) accessed with []

5 Distinctions 1

6) Hotkeys and non-autoreplace HotStrings are no longer labels; instead, they (automatically) define a function

6 Hotkeys need braces

7) All byRef variables need to have a “&” before

7 byRef 1

8) Function calls require a space or “(“. Use comma only between parameters

8 Functions require comma

9) GUI and GUI controls are now objects

9 GUIs

AutoHotkey Webinar- 07/2021 Helping people with their code

AutoHotkey webinarThis month’s AutoHotkey Webinar we helped a few people with their projects

Hour 1
Hour 2

We debuted AHKHotKeyStringLookup however I recommend you wait a day or two before downloading it so we can fix the glitch we saw in the webinar.

Dimitri mentioned this link for helping solve his goal of attaching a file to an active, inline, email

AutoHotkey Webinar- 6/2021 Helping Users- API calls, ACC library & more!

AutoHotkey webinarThis AutoHotkey webinar was pretty amazing!
Video Hour 1: Helping others: Snagit, ACC library, Controls
Video Hour 2: GUIs, PID verse hwn ID, & more

Script Highlight:  Fiddler Everywhere Ripper / API Syntax writer

We also discussed Webservice APIs.  Our AHK Webinar on APIs is a great place to start

You also might want to download our API Syntax writer

We discussed the ACC library in this ahk webinar and demonstrated its usage in this AHK Webinar

When we were working through how to best solve Snaggit issue, I mentioned the 17 ways to automate windows  as well as AutomateMyTask

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