| View previous topic :: View next topic |
| Author |
Message |
rani
Joined: 18 Mar 2008 Posts: 57
|
Posted: Fri May 23, 2008 1:14 am Post subject: kill variable and variable array |
|
|
1.
how I 'kill' a variable and variable array from current memory in script,
so it will be cleaned from memory ?
and it will not be seen in listVars ?
2.
if I have indexs in Array like:
myArray101=val1 (means index=101)
myArray10123=val2 (means index=10123)
how I can iterate on an array only on existing index's ?
and not run on whole array like for i=1 to 15000
and then find if i exists ?
rgrds
ell |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Fri May 23, 2008 2:22 am Post subject: |
|
|
- You may delete a variable's contents, but not the variable itself. The same goes for arrays, since they are technically no different from a bunch of distinct variables.
- Either iterate on all indices but skip empty items, or use ListGlobalVars or similar. Referring to an item in an expression will create it if it doesn't already exist, so be sure to use a traditional IF:
| Code: | | if myArray%A_Index% != |
|
|
| Back to top |
|
 |
rani
Joined: 18 Mar 2008 Posts: 57
|
Posted: Fri May 23, 2008 7:51 am Post subject: |
|
|
| what is the command to delete variable array content ,means all it's indices entries and values ? |
|
| Back to top |
|
 |
ImprisonedPride
Joined: 30 Apr 2008 Posts: 28
|
Posted: Fri May 23, 2008 8:27 am Post subject: |
|
|
you could always just redeclare the array contents to be nothing. _________________ Call me IP. |
|
| Back to top |
|
 |
rani
Joined: 18 Mar 2008 Posts: 57
|
Posted: Fri May 23, 2008 8:30 am Post subject: |
|
|
I tried
MyArry :=""
or MyArray =
and then I made listvars+pause
and I saw all the contest of the Myarray |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Fri May 23, 2008 4:36 pm Post subject: |
|
|
| Lexikos wrote: | 2. Either iterate on all indices but skip empty items, or use ListGlobalVars or similar. Referring to an item in an expression will create it if it doesn't already exist, so be sure to use a traditional IF:
| Code: | | if myArray%A_Index% != |
|
he has told you the solution. you must loop through the array and set each item to "" or blank
what part of your code is relying on this to be blank? It seems like a bad design requirement. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
|