Upload

Loading icon Loading...

This video is unavailable.

[AHKTuts] Ep1 - Variables [p1]

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to like AutoHotkey Tutorials's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to dislike AutoHotkey Tutorials's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to add AutoHotkey Tutorials's video to your playlist.

Uploaded on Jul 9, 2010

This is part 1 of the first video in the section for beginners. I will explain how autohotkey handles variables, how to set them up, and how to retrieve their values.

I will also show some of the common mistakes done while assigning variables and how to solve it, so in case your script is not working correctly then you know where to start looking for errors.
[Useful links]
AHKLexer for Notepad++ - http://www.autohotkey.net/~RaptorX/AH...

Below is the code for the script used on the video. It does nothing more than print the assigned variables. Later on the scripts will be more useful but in this case the purpose was just to illustrate the examples.

;[Script Starts]

; --[Ways of setting up a variable]-- ; --[equals operand]-- e_number = 1 e_string = this is a string e_string2= 5 + 5 e_mixstr = this is another string 5 + 5 msgbox e_mixstr: %e_mixstr% ;- ; --[colon equals operand]-- ce_number := 1 ce_string := "This is a string" ce_exp := 5 + 5 ce_mixexp := "this is a string " 5 + 5 msgbox ce_mixexp: %ce_mixexp% ;-




;-
; --[Retreiving the data]--
retr1 = %exp1%
retr2 := exp2
;-
; --[Common Errors]--
; e_exp1 = 5 + 5
; c_exp1 := 5 + 5 e_exp2 = 5 + 5 c_exp1 := 5 + 5 msgbox e_exp1: %e_exp2% msgbox e_exp2: %c_exp1%




;-

; e_str1 := I want to print this to the display
; c_str1 := "This is the only way to do it" c_str1 := "This is the only way to do it" msgbox e_str1: %e_str1% msgbox c_str1: %c_str1%




;-

; e_retr1 = e_exp1
; c_retr1 = %c_exp1% e_retr1 = e_exp1 c_retr1 = %c_exp1% msgbox e_retr1: %e_retr1% msgbox c_retr1: %c_retr1%




;-

; e_retr2 := %e_retr1%
; c_retr2 := c_retr1 ; Did not use the msgbox command on this one because it would cause the script to stop
;-


; e_spacing := "this is a string" . c_exp1
; c_spacing := "this is a string " . c_exp1 e_spacing := "this is a string" . c_exp1 c_spacing := "this is a string " . c_exp1 msgbox e_spacing: %e_spacing% msgbox c_spacing: %c_spacing%




;-

;-
; --[Interesting cases]--
case1 := c_exp1 + 10
case2 := "this text will be followed by number " . c_exp1
case3 := "I have " . c_exp1 . " pieces of code" msgbox case1: %case1% msgbox case2: %case2% msgbox case3: %case3%




;-
; --[Relevant: Forcing an Expression]-- Msgbox, % "this is an expression and because of that we need to add quotes" Sleep, var
;-
; --[Quick usage examples]-- if var { ;[some code here] } ; or loop %var% { ;[some code here] }
;-
;[Script Ends]

  • Category

  • License

    Standard YouTube License

Loading icon Loading...

Loading icon Loading...

Loading icon Loading...

Loading icon Loading...

Ratings have been disabled for this video.
Rating is available when the video has been rented.
This feature is not available right now. Please try again later.

Loading icon Loading...

Loading...
Working...
to add this to Watch Later

Add to