AutoHotkey Community

It is currently May 26th, 2012, 7:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: May 23rd, 2008, 1:14 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 2:22 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
  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% !=


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 7:51 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
what is the command to delete variable array content ,means all it's indices entries and values ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 8:27 am 
Offline

Joined: April 30th, 2008, 4:41 am
Posts: 70
you could always just redeclare the array contents to be nothing.

_________________
Call me IP.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 8:30 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
I tried
MyArry :=""
or MyArray =

and then I made listvars+pause
and I saw all the contest of the Myarray


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 23rd, 2008, 4:36 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, kkkddd1, tomL and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group