Deleting a script object

I have a script that creates script objects:

set theController to makeController(theObject)

How do I delete the objects when I don’t need them anymore?

delete theController

doesn’t work.

Something is removed from memory in AppleScript when there are no variables pointing to it. Just set theController to missing value, (or 0, or false, etc…), and the script object’s memory location will be ‘reclaimed’ by the script.

Hi,

Or you could place your script objects in lists if you’re not using them individually. Then at the end just empty the list or remove certain items:

property text_list : {“hello”, “goodbye”}

on makeController(the_text)
script TheController
property dialog_text : the_text
display dialog dialog_text
end script
return TheController
end makeController

set script_list to {}
repeat with this_text in text_list
set temp_controller to makeController(this_text)
set end of script_list to temp_controller
end repeat
repeat with this_script in script_list
run script this_script
end repeat
set script_list to {}

gl,