automation - AutoHotKey Array Confusion -


I want to ask that the following codes are two different arrays? Or is it the same array? In AutoHotKey I am confused how to create two different array I use an older version of AutoHotKey, see 1.0.47.06 ...

 ; Keep track of the number of discharge cases date_array_count: = 0; Keep in mind the date of discharge cases date_are_moth_ = 0 array% date_array_count%: = "01/01/2014" array @ case_arecon%: = 1001001   

And besides, if I have a variable , I use the = to specify it in the array? Or use: =?

  discharge_date: = "01/01/2014" array% date_array_count% = discharge_date    

These are not real " arrays ", they are called pseduo-arrays and this is an old way to create an array of them. Can read more.

In your case, these are the same array, yes. You are using array as your array-variable and index as date_array_count and case_array_count which are both zero, so you Both values ​​are being put in the same index, which means that you will overwrite your first value.

To specify the values, always : = . When you want to assign a string, such a string quote: myVariable: = "Hello World!" .


"Real" Arrays were added to the AH in the later version, which I strongly recommend strongly You can get the latest version from here -

Once you have the latest version, you can read more about Array in Docs -

Here is a basic example This is how to work with arrays:

 ; Make my Array: = []; Array myArray.insert ("cat") myArray.insert ("dog") add value to myArray.insert ("Python"); Loop through array for each, myArray {; Each index holds; Value holds that value on the index msgMB, ITR:% every%, value:% value%}; Get specific items from the array msgBox% myArray [2]; Find a value from an array on a set index myArray.remove (1); Loop through array for each, myArray {; Each index holds; Value values ​​in that index msgbox, ittr:% every%, value:% value%}   

You can also specify the value of arrays like this: < pre> index: = 1 myVariable: = "my other value" myArray [index]: = "my value"; My price index "1" in the array puts myArray [index]: = myVariable; Edit:

If you are unable, then the "my other value" on the index "1" is the upgrade In this way you get many pseduo-arrays and work with:

 ; Make our index variable date index: = 0 case index: = 0; Make our two array dates: Array: = "" Case: "";; Increase in the index before adding value date index; Add value to the array using the index variable dateArray% dateIndex: = "01/01/2014" Case Index ++ Case-time% Case Index%: = 1001001; Loop through array, loop-counting loop index% dateIndex {; Existing loop-index msgbox% dateArray% A_Index%} in the A_Index% caseIndex {msgBox% caseArray% A_Index%}   

And if you want arrays to share the same index:

 ; Create index variable arrIndex: = 0; Make our two array dates: Array: = "" Case: "";; Increase the index before adding value to arrIndex ++; Add value to the array using the date of the indicator variableAir% arrIndex%: = "01/01/2014" Case%% arrIndex%: = 1001001 arrIndex ++ dateArray% arrIndex%: = "02/02/2014" Case% arrIndex %: = 999999; Loop through array, index loop-gate loop% arrIndex {; Existing loop-index msgbox% dateArray% A_Index% "` n "case is% A_Index%}     in A_Index

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -