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 

Completely deleting a variable?

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



Joined: 23 Feb 2008
Posts: 96
Location: North Carolina

PostPosted: Wed Jul 23, 2008 1:19 pm    Post subject: Completely deleting a variable? Reply with quote

I need to delete a variable (not set it to 0) Completely delete it so that it may use it again later in the script. How would I do this.

Thank you in advance Smile
_________________
http://www.mofiki.com
Back to top
View user's profile Send private message
SpiderGames



Joined: 09 Jun 2008
Posts: 290
Location: Canada

PostPosted: Wed Jul 23, 2008 1:21 pm    Post subject: Reply with quote

what do you mean... like you want somehting like this???
Code:

vfish = 10
delete vfish ; ???
vfish = 90

Because you can't do that... do somethign like this.
Code:

vfish = 10
vfish2 = 90

you can have alot more than 1 varriable. One of my script has about 85 varriables that read off a file.
_________________
http://www.spider-games77.piczo.com
Join the Elite few...
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Wed Jul 23, 2008 1:22 pm    Post subject: Reply with quote

What is wrong with
Code:
Var =
this will empty the variable
Back to top
View user's profile Send private message
Moki



Joined: 23 Feb 2008
Posts: 96
Location: North Carolina

PostPosted: Wed Jul 23, 2008 1:26 pm    Post subject: Reply with quote

Code:
nextpoint:

Gui +AlwaysOnTop -Caption +ToolWindow
Gui, -Caption +ToolWindow -SysMenu +AlwaysOnTop
Gui, Font, s8
Gui, Add, Text, x10 y3 w200 h15, %energypoints% - Energy
Gui, Add, Progress, x10 y18 w200 h10 vProgress, 0
y := A_ScreenHeight - 60
x := A_ScreenWidth -  220
Gui, Show, NoActivate y%y% x%x% h30


Loop, 5
{
   Progress += (100 / 5)
   GuiControl,, Progress, %Progress%
   Sleep, 1000
}

energypoints := (%energypoints% + 1)
Gosub, nextpoint


ExitApp


This is the code when it starts again it crashes because the progress variable cannot be used again. Any ideas other than deleting the variable?
_________________
http://www.mofiki.com
Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 370
Location: canada

PostPosted: Wed Jul 23, 2008 1:27 pm    Post subject: Reply with quote

As per help file.

Quote:
The memory occupied by a large variable can be freed by setting it equal to nothing, e.g. var := ""


You dont have to "delete" the variable.

var := 10
var := "asdf"

You can change it anytime.
_________________
-=Raz=-
Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 370
Location: canada

PostPosted: Wed Jul 23, 2008 1:31 pm    Post subject: Reply with quote

Oh.. use

Code:
gui destroy


at the start
its one way around that.


Code:
nextpoint:
gui destroy
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, -Caption +ToolWindow -SysMenu +AlwaysOnTop
Gui, Font, s8
Gui, Add, Text, x10 y3 w200 h15, %energypoints% - Energy
Gui, Add, Progress, x10 y18 w200 h10 vProgress, 0
y := A_ScreenHeight - 60
x := A_ScreenWidth -  220
Gui, Show, NoActivate y%y% x%x% h30


Loop, 5
{
   Progress += (100 / 5)
   GuiControl,, Progress, %Progress%
   Sleep, 1000
}

energypoints := (%energypoints% + 1)
Gosub, nextpoint


ExitApp


Your more then likely missing a return in your code as well.
right now your code just does a never ending recursive loop.
_________________
-=Raz=-


Last edited by Razlin on Wed Jul 23, 2008 1:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
Moki



Joined: 23 Feb 2008
Posts: 96
Location: North Carolina

PostPosted: Wed Jul 23, 2008 1:34 pm    Post subject: Reply with quote

ok thank you very much ... I was trying to think of a way to describe it better lol. nobody was understanding the question but you hit the nail on the head.

Thank you very much Smile
_________________
http://www.mofiki.com
Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 370
Location: canada

PostPosted: Wed Jul 23, 2008 1:36 pm    Post subject: Reply with quote

Your welcome.
_________________
-=Raz=-
Back to top
View user's profile Send private message
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