Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Variables not behaving locally


Best Answer Jackie Sztuk _Blackholyman , 22 April 2015 - 07:52 PM

Go to the full post »


  • Please log in to reply
2 replies to this topic
Jeffrey562
  • Members
  • 22 posts
  • Last active: Apr 30 2015 08:08 PM
  • Joined: 03 Apr 2015
I posted something similar to this before, but posted a lengthy script to go along with it. This time I've isolated the issue given a short code.
 
InputBox, S, Input, , , 275, 100
if ErrorLevel
	Return
else
	
StringSplit, S, S, - .
MsgBox %S1%
MsgBox %S2%

return
Here's the problem. Give the program the input '513-3' and the program operates as it should. Give the program the input '513' and the program will remember S2 from the previous execution. Would it be possible to have the program forget everything after it has completed running?

Jackie Sztuk _Blackholyman
  • Spam Officer
  • 3757 posts
  • Last active: Apr 03 2016 08:47 PM
  • Joined: 28 Feb 2012
✓  Best Answer
You can end your script with exitapp or reload, that will clear any left over vars

You can also use the function strSplit() and reuse the same variable for the array it return's
Helping%20you%20learn%20autohotkey.jpg?d

[AHK] Version. 1.1+ [CLOUD] DropBox ; Copy [WEBSITE] Blog ; About

Jeffrey562
  • Members
  • 22 posts
  • Last active: Apr 30 2015 08:08 PM
  • Joined: 03 Apr 2015
Thanks Blackholyman. Your suggestion works well.