Page 1 of 1

Error Message

Posted: Tue Jul 03, 2012 4:04 pm
by laurpapo
Hi,

Can you tell me what this error message means? Or how I would go about fixing it? The object in question is a field I'm trying to delete. For some reason it won't let me...

stack "C&LMapper": execution error at line n/a (Object: stack locked, or object's script is executing)

Thanks!

Re: Error Message

Posted: Tue Jul 03, 2012 4:17 pm
by Klaus
Hi Laurel,

what did you script and what object is (trying to) executing the script?


Best

Klaus

Re: Error Message

Posted: Tue Jul 03, 2012 4:33 pm
by laurpapo
This is the script:

on undogroup
local tLinktoDelete
set the itemdelimiter to tab
put item 3 of line 2 of gLastAction into tLinktoDelete
repeat until lineoffset(tLinktoDelete, gCurrentlinks) =0--repeats until all of the graphic lines are gone
delete graphic line lineoffset(tLinktoDelete, gCurrentlinks) of gCurrentLinks--deletes lines connected to deletednodes
delete line lineoffset(tLinktoDelete, gCurrentlinks) of gCurrentLinks
end repeat
delete field item 3 of line 1 of gLastAction
delete field item 3 of line 2 of gLastAction
end undogroup

It's in the stack script, called by a button. Everything works fine until the last line. That field isn't getting deleted.

Re: Error Message

Posted: Tue Jul 03, 2012 5:34 pm
by Klaus
Hmm, no quick idea...

Does adding parens help?

Code: Select all

...
  delete field (item 3 of line 1 of gLastAction)
  delete field (item 3 of line 2 of gLastAction)
end undogroup
Best

Klaus

Re: Error Message

Posted: Tue Jul 03, 2012 5:41 pm
by laurpapo
Nope :(

However, after some sleuthing I think I know what the problem is. At a different place in the stack script, a "mousedown" is sent to the field I want to delete. If I delete that command, I no longer have the problem. The "mousedown" is crucial at an earlier point, though, so I have to keep that in. Is there anyway to tell an object's script to stop executing? I kind of hoped "mouseup" would undo it but no such luck...

Re: Error Message

Posted: Tue Jul 03, 2012 6:08 pm
by Klaus
Hi Laurel,
laurpapo wrote:However, after some sleuthing I think I know what the problem is. At a different place in the stack script, a "mousedown" is sent to the field I want to delete. If I delete that command, I no longer have the problem.
AHA! Well in that case the error is definitively correct :-)
laurpapo wrote:The "mousedown" is crucial at an earlier point, though, so I have to keep that in. Is there anyway to tell an object's script to stop executing?
Depends on how you created your stack, app and message architecture!
Can't you handle it another way? Maybe wait until the "mousdown" has been executed?

Sorry, need more info...
laurpapo wrote:I kind of hoped "mouseup" would undo it but no such luck...
Well... 8)

Best

Klaus

Re: Error Message

Posted: Tue Jul 03, 2012 6:38 pm
by mwieder

Code: Select all

-- only do this if the field has not been deleted
if there is a field "xyzzy" then
  send "mouseDown" to field "xyzzy"
end if

Re: Error Message

Posted: Wed Jul 04, 2012 2:36 am
by Mark
Hi,

Instead of telling the script to stop running, you can delete the fields after all other handlers have stopped running:

Code: Select all

send "delete field (item 3 of line 1 of gLastAction)" to me in 0 millisecs
send "delete field (item 3 of line 2 of gLastAction)" to me in 0 millisecs
or if that doesn't work

Code: Select all

send "delete field" && quote & item 3 of line 1 of gLastAction & quote to me in 0 millisecs
send "delete field" && quote & item 3 of line 2 of gLastAction & quote to me in 0 millisecs
Kind regards,

Mark

Re: Error Message

Posted: Thu Jul 05, 2012 6:41 pm
by laurpapo
Thank you all for your help! I ended up finding a way around "mouseup" earlier in the script.

Thanks!