Jump to content

Recommended Posts

in autohotkey "%" character is using for revert variable to string. also this character can be use with variables.for example in AHK:

variable1 := 1

variable2 := 2


    tmp := variable%A_Index%

    msgbox , %tmp%

    if(A_Index = 2){






this script print "1" and "2" on the screen. then exit


is there a thing in autoit what do same work ?

help me please and sorry 4 bad english


Link to post
Share on other sites

You could do it like this :

#include <Constants.au3>

Local $variable1 = 1
Local $variable2 = 2
Local $tmp
For $i = 1 to 2
    $tmp = Eval("variable" & $i)
    MsgBox ($MB_SYSTEMMODAL, eval("tmp"), $tmp)

But we usually discourage using this type of assignment.  You would probably be better with an array.

Local $aArray[2] = [3, 4], $tmp
For $i = 0 to UBound($aArray) - 1
  $tmp = $aArray[$i]
  MsgBox ($MB_SYSTEMMODAL, $aArray[$i], $tmp)


Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...