Caprier
04-02-2009, 01:05 PM
(
global rltTest
try destroyDialog rltTest catch()
rollout rltTest ""
(
pickbutton pbObject "Pick"
button btnDoIt "Do it"
local theObject
on pbObject picked obj do
(
theObject = obj
)
on btnDoIt pressed do
(
theObject.name = "myObject"
theObject.pos = [0,0,0]
)
)
createDialog rltTest 60 60
)
In the code above, someone pointed out that if the user picks the object, then deletes it and presses the Do it button, then the script crashes.
I've searched the reference to find a way for the script totrelaunch itself and the closest I could find was this:
try theObject.name = "myObject" catch(fileIn (getSourceFileName()))
Still, no joy. The script does restart, thus replacing the dialog by a new one. But at the same time it crashes at the next line. Beep + error in the listener.
How can I deal with this error?
global rltTest
try destroyDialog rltTest catch()
rollout rltTest ""
(
pickbutton pbObject "Pick"
button btnDoIt "Do it"
local theObject
on pbObject picked obj do
(
theObject = obj
)
on btnDoIt pressed do
(
theObject.name = "myObject"
theObject.pos = [0,0,0]
)
)
createDialog rltTest 60 60
)
In the code above, someone pointed out that if the user picks the object, then deletes it and presses the Do it button, then the script crashes.
I've searched the reference to find a way for the script totrelaunch itself and the closest I could find was this:
try theObject.name = "myObject" catch(fileIn (getSourceFileName()))
Still, no joy. The script does restart, thus replacing the dialog by a new one. But at the same time it crashes at the next line. Beep + error in the listener.
How can I deal with this error?
