Using variables

Get help with using AutoHotkey and its commands and hotkeys
Posts: 19
Joined: 20 Oct 2017, 06:52

Using variables

20 Oct 2017, 07:07


Just discovered AutoHotKey and it's fantastic!
I'm trying to write some scripts and I have a very basic problem: I don't understand how variables are supposed to work. I HAVE seen the page but it doesn't help me.

In ording to test setting and retrieving a variable, I'm trying to set a certain value (ex:12) to a variable, then display it in a message box when hotkey pressed. Here's what I have:

Code: [Select all] [Download] GeSHi © Codebox Plus

^F4:: MsgBox, %MyVar%

If I do so, the Message box displays an empty value.

Can someone please explain more clearly than the documentation how variables are supposed to work?

Thanks !!

NB : I'm not a dev nore a super-geek so don't hesitate to be very basic in your explanations. I do have some programming notions though, so not problem with the concept of variable itself.
Posts: 3163
Joined: 17 Jul 2016, 01:02

Re: Using variables

20 Oct 2017, 07:14

Hello and welcome.
There is nothing wrong with your script. It displays 12 in the message box. If that code is part of a larger script, you need to consider the auto execute section. Also, see the tutorial.
Posts: 19
Joined: 20 Oct 2017, 06:52

Re: Using variables

21 Oct 2017, 03:14

OK I get it. Thanks a lot Helgef !

Return to “Ask For Help”

Who is online

Users browsing this forum: Immanuel, scriptors, swagfag and 73 guests