Page 1 of 1
Deleting Globals
Posted: Wed Jul 09, 2008 9:41 am
by bjb007
As we can declare
global v1, v2, v3 ...etc.
would be handy to be able to
delete global v1,v2, v3 ...etc
rather than
delete global v1
delete global v2
delete global v3 ....etc.
Posted: Wed Jul 09, 2008 1:24 pm
by whelkybaby
If you've got a number of globals to delete, could you not just:
Code: Select all
put "v1,v2,v3,v4,v5" into the lVariableList
repeat with i = 1 to number of items of lVariableList
delete global (item i of lVariableList)
end repeat
The code could be turbocharged with a 'repeat for each' method, but I thought I'd keep it simple!
Steve
Deleting Globals
Posted: Wed Jul 09, 2008 2:17 pm
by bjb007
Could do that but would rather
be able to copy the
global declaration line(s) and put "delete"
in front.
Posted: Wed Jul 09, 2008 2:37 pm
by malte
I also think that would be handy.
Best,
Malte
Posted: Wed Jul 09, 2008 10:29 pm
by BvG
Untested
Code: Select all
global a,b,c
on mouseUp
deleteGlobals
end mouseUp
on deleteGlobals
put line 1 of the script of me into theGlobals
delete word 1 of theGlobals
repeat for each item theItem in theGlobals
delete global theItem
end repeat
end deleteGlobals