• Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

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

2) Variables need to be declared

3) “All” commands are now also functions

4) Some functions now return objects

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

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

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

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

9) GUI and GUI controls are now objects

 

TLDR: The 62nd AutoHotkey webinar discussed the benefits and challenges of switching to version 2, which offers improved consistency and cleaner code, but may require code conversion and can be less forgiving for beginners.

1. 00:00 📢 The 62nd AutoHotkey webinar discussed podcast topics, demonstrated Quick Access Pop-up, and provided a code template for running AutoHotkey in a specific business with the Unicode version.
1.1 The 62nd AutoHotkey webinar had 112 registrants and participants were asked to ask questions in the chat instead of speaking due to the potential for confusion.
1.2 The speaker discussed various podcast topics including version two, increasing the likelihood of script running on multiple computers, and the pros and cons of subscription-based vs one-time fee sales.
1.3 The speaker shared their screen and demonstrated how to use Quick Access Pop-up with AutoHotkey in the 32-bit version.
1.4 The speaker provides a code template that can be downloaded to force AutoHotkey to run in a specific business with the Unicode version, which is a useful function that should be built into AutoHotkey.

2. 04:45 🚀 The new version of the cjson parser improves code consistency and speed, while the changes in autohotkey code may be less forgiving for beginners.
2.1 Geek dude’s new version of the cjson parser works in both 64-bit and 32-bit, and thanks to everyone who develops and runs the forum.
2.2 The speaker discussed the changes from version 1.1 to version 2 and provided examples of how to correctly convert code to avoid errors.
2.3 In the updated version, everything is a function and errors occur when a variable is not declared, resulting in better code and fewer commands.
2.4 The upgrade may improve consistency and speed, but benchmarking is needed to determine the extent of the improvements.
2.5 The changes in version two of autohotkey code are simpler and less arbitrary, but may be less forgiving and not as easy for beginners to learn.
2.6 The speaker thinks the new conversion process is great despite concerns, and is currently working on a converter that is improving but may have difficulty handling large changes.

3. 14:01 👨‍💻 Arrays, hotkeys, and objects behave differently in Autohotkey version 2, but it has improved consistency and nested functions.
3.1 Arrays behave differently in version one and version two, with brackets and points having different effects, and it’s important to understand these differences when working with arrays.
3.2 Fix hotkeys by adding brackets and use an ampersand before name to avoid errors.
3.3 Version 2 of the programming language requires a space instead of a comma for the first variable in commands, and the use of objects has been changed.
3.4 Autohotkey version 2 has improved consistency and nested functions, making it easier for editors to do their intellisense type stuff and allowing for special tools without interfering with the rest of the program.
3.5 Learning it was easy with just understanding the birth variables, and there were not many difficulties encountered.

4. 22:25 📝 The speaker discussed code conversion challenges and loop confusion, while also sharing their struggles with using Hit Up and making changes to improve their skills.
4.1 The speaker discussed adding an ampersand sign to the function declaration and clarified that loops are not functions.
4.2 The speaker created a converter to convert version one code to a new version, but loops as a function can be confusing and the converter is currently only for testing purposes.
4.3 The speaker discussed the challenges of converting code and the need to sometimes invent methods to achieve the same results, while acknowledging that there may be better ways to code and asking for a link to the converter.
4.4 The speaker struggled with using Hit Up, a coding script adopted from another person, and made changes to it before the original coder stopped helping, leading to the speaker working offline to improve their skills.

5. 28:24 👨‍💻 Switching to version two of AutoHotkey can avoid issues and the speaker is working on converting functions from version one to version two.
5.1 V2 began around 10-12 years ago and the error level variable in V2 produces the same result as the V1 goat.
5.2 Consider switching to version two to avoid the same issues Python faced when switching between versions two and three.
5.3 Many people still have thousands of Python 2 scripts written in legacy libraries and converting them to Python 3 can be a daunting task.
5.4 The speaker demonstrated how to run different versions of AutoHotkey using a small script that detects the version number in the first 20 lines of the file.
5.5 The speaker is working on converting functions from version one to version two, focusing on the most used ones, and believes that com objects should work the same regardless of the language used to connect to them.

6. 36:49 💻 Using AutoHotkey version 2 leads to cleaner and more consistent code, with a 64-bit installer for easier management of hotkeys and scripts.
6.1 Functions are preferred over commands in programming as they have a cleaner syntax and are easier to understand, and while the old way of dealing with double quotes in version one is no longer available in version two, single quotes can be used instead.
6.2 Using version two of the converter leads to more consistent and cleaner code in the long run.
6.3 When installing AutoHotkey version 2, it does not install version 1 and comes with a 64-bit installer, which allows for easier management of hotkeys and scripts.
6.4 Learning the syntax of a new coding language is important to be able to use the same rules in your code and make the transition easier.
6.5 Version one library for functions has two functions inside, and it is easy to transition without converting the whole code, but it is hard to differentiate between exchanges.
6.6 The speaker stumbled upon forum posts about hotkeys using vanilla and l versions while learning dot notation with auto hotkey.

7. 47:00 💻 AutoHotkey users should consider using separate sub-forums or tags to indicate the version being used, and a converter can help avoid problems when transitioning to version 2.
7.1 Use separate sub-forums or tags to indicate the version of AutoHotkey being used to avoid confusion, and consider using custom extensions for more interactive output.
7.2 Autohotkey version 2 has new functionality and changes that shouldn’t break version 1, but it may take a while for it to gain widespread popularity.
7.3 Language should be concise and consistent, although every language has its quirks.
7.4 A gradual move to version two would damage adoption and cause problems in the community, so a converter can be a great help for people to avoid that kind of mess.
7.5 Automating 80% of the work is helpful and efficient, as it saves time and effort.

8. 54:59 👨‍💻 It’s suggested to make a community-wide effort to switch to a new version of AutoHotkey to avoid supporting multiple languages, but it may be difficult due to the large amount of content that still works with the old version.
8.1 There are some improvements in AutoHotkey version 2, but there is no compelling reason for existing users to switch to it.
8.2 Users may not switch to AutoHotkey version 2 quickly as long as they can find examples of version 1 scripts in the community.
8.3 To avoid the challenge of supporting multiple languages, it is suggested that a community-wide effort should be made to switch to a new version as fast and hard as possible, although it may be difficult due to the large amount of content that still works with the old version.
8.4 The majority of code in the programming language Otaha is found in a select few places, such as Reddit and hockey forums, and efforts could be made to create a foolproof converter to update outdated code.
8.5 The speaker suggests using a tool to nudge developers to use version two and setting up rules to check for version one code in posts to reduce confusion and fragmentation in programming languages.
8.6 The speaker discusses the implementation of Lactico’s version of AutoHotkey and how it drove some people away, while also mentioning the debate between Lactico’s version and the previous version.

Summary for https://youtu.be/R-AJgevfZ3k by www.eightify.app

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