AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

kill variable and variable array

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
rani



Joined: 18 Mar 2008
Posts: 57

PostPosted: Fri May 23, 2008 1:14 am    Post subject: kill variable and variable array Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Fri May 23, 2008 2:22 am    Post subject: Reply with quote

  1. 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.

  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% !=

Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 57

PostPosted: Fri May 23, 2008 7:51 am    Post subject: Reply with quote

what is the command to delete variable array content ,means all it's indices entries and values ?
Back to top
View user's profile Send private message
ImprisonedPride



Joined: 30 Apr 2008
Posts: 28

PostPosted: Fri May 23, 2008 8:27 am    Post subject: Reply with quote

you could always just redeclare the array contents to be nothing.
_________________
Call me IP.
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 57

PostPosted: Fri May 23, 2008 8:30 am    Post subject: Reply with quote

I tried
MyArry :=""
or MyArray =

and then I made listvars+pause
and I saw all the contest of the Myarray
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Fri May 23, 2008 4:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group