Page 1 of 1

Simple Arrays for Dummies from a non-programmer

Posted: 30 Dec 2013, 22:11
by Joe Glines
While the forum is awesome at providing great information and there are a ton of people that have helped solve many of my problems, one of my few gripes is that I often get advice that is probably easy for a programmer to follow however, given I'm new to programming, I find it very hard to follow.

I'd been working with both Simple and Associative arrays lately and many examples I found in the forum as well as AutoHotKey help were difficult for me to follow.

Thus I decided to take a crack at writing a tutorial from the non-programmer perspective. I'm sure some of my terminology is not correct (and some of it might flat out be wrong) but the below script works in the way that I describe in the video which I hope some other non-programmers will find helpful.

Below is the script I use in this video. With any luck you will find it helpful in understanding how to use simple arrays in AutoHotKey.
Spoiler

Re: Simple Arrays for Dummies from a non-programmer

Posted: 01 Jan 2014, 16:02
by vahju
Great video and script.
I haven't had a need to use arrays yet but thanks to this post may start using them.

Did you use skype to do the recording?

Re: Simple Arrays for Dummies from a non-programmer

Posted: 01 Jan 2014, 21:05
by Joe Glines
Thanks! I didn't expect the video to be so long but I'm glad it might help. I used Camtasia to record the video.

Re: Simple Arrays for Dummies from a non-programmer

Posted: 01 Jan 2014, 21:17
by budRich
Cool, nice work! This will surely help people getting started with arrays.

Re: Simple Arrays for Dummies from a non-programmer

Posted: 19 Nov 2014, 18:07
by SnowPickle
Thanks Great Video, very thorough and great examples.

Re: Simple Arrays for Dummies from a non-programmer

Posted: 17 Feb 2016, 08:42
by kwibus
@Joe Glines:
Thanks! I am also at the very start now. My first question is about these lines:

Code: Select all

RAlt::
Browser_Forward::Reload
RControl::
Browser_Back::
What is there use? Are these necessary?

Re: Simple Arrays for Dummies from a non-programmer

Posted: 17 Feb 2016, 08:45
by guest3456
kwibus wrote:@Joe Glines:
Thanks! I am also at the very start now. My first question is about these lines:

Code: Select all

RAlt::
Browser_Forward::Reload
RControl::
Browser_Back::
What is there use? Are these necessary?
those are the start of hotkey definitions. anytime you see a keyname followed by the double colon, that indicates the start of a hotkey for that key
https://autohotkey.com/docs/Hotkeys.htm

in this case, if i had to guess, it looks like those don't belong in this script and are probably a mistake or left over from his testing

Re: Simple Arrays for Dummies from a non-programmer

Posted: 17 Feb 2016, 09:29
by Joe Glines
Sorry- I've been slammed at work. Those are 4 hotkeys for two main commands. The first two (right alt and Browser_Forward) will reload the script. The second two (Right control and Browser_back) will "launch" the actions beneath.

I like tying everything to a hotkey so I can easily hit a button and have my action execute, then edit the code, hit the other hotkey to reload, then repeat. Just saves me a lot of time.

Re: Simple Arrays for Dummies from a non-programmer

Posted: 01 Jul 2017, 12:33
by BoBo
I like tying everything to a hotkey so I can easily hit a button and have my action execute, then edit the code, hit the other hotkey to reload, then repeat. Just saves me a lot of time.
Exactly the way I've done it as well, what is fine as long as you don't want to #Include that file within another script were it will throw errors like "duplicate hotkeys" because you use your favourite hotkeys all over the place etc. :shifty: for that reason I've stolen Trubbleguy's test scenario :thumbup:
It's working this way (let's assume your editor allows to execute a script with its own build in keyboard shortcut) ...

Code: Select all

If (A_Scriptname = "<the script name here>"){ ; that section will only get executed via its host file, while getting ignored if included and executed via another script
    MsgBox % function("Hello World")
    ExitApp
    }

function(msg){
    Return % msg
    }