Jump to content
Tuts 4 You

Learn To Autohotkey!


Guest bGraHam-AhK

Recommended Posts

Guest bGraHam-AhK

Last Tutorial i showed one of the most basic AhK scripts i could think of.

So this time im showing an expanded version of that, variables.

We will learn 2 things:

:adding two individal strings

:adding two individual numbers together

~~~~~~~~~~~~~~~~~~~~~~~~~~

Adding Two Seperate Strings:

~~~~~~~~~~~~~~~~~~~~~~~~~~

Open a new txt document and type in the following code:

firststring := "Hello"
secondstring := "World"
afteradding = %firststring% %secondstring%MsgBox, %firststring%+%secondstring% = %afteradding%!

The Breakdown:

"firststring" if you were to write this out alone, you would get an error

but when you use a "=" or ":=" it will become a variable.

"=/:=" these two do different things

= can hold anything, as can := but the difference is, "=" cant do mathematic equations

and ":=" cant put two variables cleanly (see *1) together!

*1. e.g: := %variable1% %variable2% will show exactly that, not the variables themselves.

%any variable or built in location ids%: anything between %% will point towards something else

e.g. %A_WorkingDir% should set whatever you use %A_WorkingDir% in to your current scripts location.

luckily the makers of AutoHotKey weere nice enough to make message boxes show variables cleanly.

Well that should be enough for tonight.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...