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

Amazing Advanced course on AutoHotkey Objects and Classes – Coming in 2022

We’re working on an advanced course deep-diving into Objects in AutoHotkey.  In the Intermediate AutoHotkey course I covered some of the basics of storing data in Objects however, with the help of RaptorX / Isaias Baez I’m creating a course that dives deep into AutoHotkey Objects and Classes

We’re finalizing the outline and beginning to produce the videos.  Below is a current peak into what will be covered.  If you’d like to stay informed, please complete this short form and we’ll keep you in the loop!

AutoHotkey Objects and Classes

  • What AutoHotkey objects and classes are and why you should learn them
  • What can be done with objects
  • Diving into: Items, Keys, Properties and Methods
  • Quick refresher on Functions
  • Object Types (Arrays, Associative Arrays, Multi-dimensional arrays, Maps (new in V2
  • Advantages & Disadvantages of Dot Notation and Object Oriented Principles
  • Functional Programming Concepts and Terminology
  • Creating your own Objects & Classes
  • What is a COM Object & Why you should use one
  • What COM objects are available
  • Reading and Understanding the MSDN Documentation
  • Nuances & best practices

AHK Webinar- Simple and Associative Arrays in AutoHotkey

AutoHotkey Bottle 1We had a great webinar on Arrays!  Here are links to the videosSimple and Associative Arrays in AutoHotkey

  • First hour video discussing below points
  • Second hour where we took a deep dive trouble-shooting an attendee’s script

Benefits of Simple and Associative Arrays in AutoHotkey

  • Speed – Objects are very fast!
  • Code maintenance / easier to update
  • Structured data
  • Easier to read / understand
    • Dot notation (names) can be very easy to read
    • Automatically group “variables” in a meaningful structure / Nesting deeper levels
  • Built-in functionality
  • Iterating over keys / values
  • Insert / Append to last
  • Remove / Remove last item
  • Count (Length)
  • Set / assign value (Index/Key – Value pair)
  • Retrieve / Lookup (Index/Key – Value pair)

AutoHotkey Merchandise-White Stress ballThings to Remember with Simple and Associative Arrays in AutoHotkey

  • Keys are not case sensitive The following results in one key-value pair: {ex:1,EX:2}
  • Keys are unique (If you have duplicates, only the last one will be kept)
  • Simple Arrays can not have “empty” spots
  • Associative Arrays are not, necessarily, ordered in the way you’d expect (when iterate over can seem out of order)
  • Simple arrays are sequential
  • Simple Arrays can be considered Associative Arrays where the Index is the key
  • You must declare the object before or during population
  • To “nest” an object, you must declare the Parent and sub-objects first too!
  • Although the same, Lexikos recommends using { } for Associative Array & [ ] for Simple Array
  • You do not need to save the object to iterate over it
  • Arrays are often returned from API calls in JSON
  • While Simple and Associative Arrays in AutoHotkey take a bit of getting used to, in the long run, they are great time savers!

Resources for learning Simple and Associative Arrays in AutoHotkey

Featured script

Pasting clipboard to p.ahkscript.org– great for collaborating with others!

AutoHotkey Bottle 1Additional Resources

During the webinar a few other scripts were mentioned.  Here are the links that were shared:

MsgBox, % ObjectToString({"AHK" : [1, 2, 3], "Joe" : ["http://the-automator.com/"], "Jackie" : {"URL" : "https://jszapp.com/"}})

ObjectToString(obj){
	if(!IsObject(obj)){
		return __IsNum(obj) ? obj : """" obj """"
	}
	bool := obj.Length()
	res .= bool ? "[" : "{"
	for key, value in obj {
		res .= (!bool ? """" key """ : "  : "") ObjectToString(value) ", "
	}
	return SubStr(res, 1, -2) (bool ? "]" : "}")
}

__IsNum(Num){
	if Num is Number
		return 1
	return 0
}