Page 1 of 1

Exiting script after going to card

Posted: Sat Apr 22, 2017 4:17 pm
by jalz
Hi Guys,

I have an unusual issue here. I've got the following code, and it seems to exit after it hits the go to card tCardName of stack "Print" line. Can anyone shed any light why the function would stop exiting if it went to a card. I've put in breakpoints and walked through, it doesn't seem like its executing any script when it opens the card and the current script I am in seems to exit after the card appears on the screen.

Any advice would be much appreciated
Thanks
Jalz

Code: Select all

  ------------<Start building the pages>--------------
   put the visible of group tPrintObjectLine of card "Stationary" of stack "Stationary" into tVisible
   set the visible of group tPrintObjectLine of card "Stationary" of stack "Stationary" to true
   copy group tPrintObjectLine of card "Stationary" of stack "Stationary"
   set the visible of group tPrintObjectLine of card "Stationary" of stack "Stationary" to tVisible
   
   put "Print " & tPageNo into tCardName
   
   lock screen
   go to card tCardName of stack "Print"
      
   put the number of elements of tGrid into tGridCount

   repeat with tIndex = 1 to tGridCount
      
   ...... more code

   end repeat

Re: Exiting script after going to card

Posted: Sat Apr 22, 2017 11:46 pm
by FourthWorld
Try adding "lock messages" in a new line immediately following "lock screen". If that fixes the problem then you probably have one of the "open" messages ("preOpenCard", preOpenBackground", "openCard", etc.) being triggered in a shared group, a card, the stack, or (if the Print stack is a substack) the mainstack of the stackffile.

Re: Exiting script after going to card

Posted: Mon Apr 24, 2017 8:27 pm
by jalz
Thanks Richard

That seemed to worked. I cant seem to find the open messages that may be causing this but I presume the lock messages command can be used permanently to rectify the open messages being triggered.

Re: Exiting script after going to card

Posted: Mon Apr 24, 2017 8:51 pm
by FourthWorld
4W Flight Recorder to the rescue!

I wrote a utility that will log messages and triggered handlers in an indented list to make it easy to track such things down.

You can get 4W Flight Recorder in the Stack Files section of LiveNet, a plugin pre-installed with LiveCode (in the LC menu bar see Development -> Plugins -> GoLiveNet ).