Dictionaries / Associative Arrays in ahk

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Joe Glines
Posts: 697
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Dictionaries / Associative Arrays in ahk

10 Jan 2015, 09:19

I'm not a programmer but have been using AutoHotKey for years and am learning Python. (please bare with me on my use of terms)

Recently I've been learning a lot about dictionaries and find them to be amazingly helpful (I'm surprised I don't see more use of them in ahk scripts.)

I was following this great, concise, simple post in particular which uses a Scripting Dictionary via COM. http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p396

From my understanding, in Python, dictionaries are "hash tables" http://en.wikipedia.org/wiki/Hash_table.

1) Does AHK / COM work the same way as Python storing them in a Hash table?

Also, I read that, in Python, dictionaries have an interesting ability to not slow down regardless how large the array is. (or at least within some degree)
2) Will AHK also have the same (or close) type of performance on an a dictionary (compared to storing it in some other way)

My layman's understanding of how Python accomplishes this is that it translates the Key into the memory location thus,upon retrieval, it doesn't have to "look up" where it is stored.
3) Am I way off on my understanding? If so, can someone pretend they are explaining it to my 7-year-old please?

Thank you in advance for any/all help!

Find & Click AutoHotkey syntax writer Automate my Task :clap:
AHK Tutorials:Web Scraping | AHK Studio | Webservice APIs | Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
Connect with me on LinkedIn :beer: | YouTube
How-to: Create a shortcut that automatically
logs in to any website

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
Help support the AutoHotkey foundation
User avatar
jethrow
Posts: 188
Joined: 30 Sep 2013, 19:52
Location: Iowa

Re: Dictionaries / Associative Arrays in ahk

10 Jan 2015, 10:33

Joetazz wrote:I'm not a programmer but have been using AutoHotKey for years and am learning Python.
Since you're not a programmer, we're on the same page. Comparing AutoHotkey to Python in terms of usage is Ok, but comparing under-the-hood prolly isn't that useful.

The Scripting.Dictionary object is a COM object, which isn't implemented by AutoHotkey. There is very little advantage to using a Scripting.Dictionary object over an AutoHotkey Object (see here).

AutoHotkey's Objects, in their basic core usage, are Associative Arrays - and are very similar to Python's dictionaries.
User avatar
Joe Glines
Posts: 697
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Dictionaries / Associative Arrays in ahk

10 Jan 2015, 11:02

@Jethrow-
Thank you for the edification! I look forward to reading up on the links you provided

You may not be a programmer but I've been following your posts for YEARS and attribute much of what I have learned to your posts (especially on the Webpage / DOM tutorial!

Find & Click AutoHotkey syntax writer Automate my Task :clap:
AHK Tutorials:Web Scraping | AHK Studio | Webservice APIs | Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
Connect with me on LinkedIn :beer: | YouTube
How-to: Create a shortcut that automatically
logs in to any website

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
Help support the AutoHotkey foundation

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot] and 52 guests