A lot of crashing when debugging scripts talking to InDesign

Hi Mark, I saw a few weeks ago you were calling somebody who was experiencing a lot of crashes on the new beta version.
I’m also experiencing a lot of crashes since a very long time. Every time I send out the crashreport but you don’t ask me anything.
Do you have a view, from the crash reports, what can be the cause for the crashes that appear while debugging my scripts. Mostly I send them without any entering a ‘What I was doing…’ I did it the first times I encountered it but then stopped doing it because it occurred so frequently.

I can’t live without Script Debugger for all my projects, but sometimes the crashing is very annoying.

Can you please look into this?

Luc
a long time ScriptDebugger user

Sorry for not responding. For some reason I thought this was Script Debugger 8 related, but I see now you are using Script Debugger 7 and I can see all the crash reports you’ve submitted.

The crashes are all happening deep within AppleScript as it executes your code or when Script Debugger asks AppleScript to prepare your script for storage.

If you can isolate a relatively small piece of AppleScript code that illustrates the crash you are experiencing, we can examine it and try and figure out what’s driving AppleScript into the weeds.

Excuses accepted :blush: Mark,
At the moment I wrote this I was very stressy when encountering those crashes.

As you ask, isolate, is very difficult because it’s a script that uses about 6 or 7 different script libraries.
I know now will Shane come in and say: Your crazy to use that many libraries :face_with_monocle:
The only constant I ‘feel’ is that it always has something to do when InDesign is used. I already had some cases than I had to restart InDesign, not that it hung, but just to clear something, so the crashing of running the script in SD stops. I’ve never tried Script Editor at that moment because, as I already stated, I can’t live without SD :star_struck:

Keep up the good work!
As you always say: Cheers!

No, I’m not going to say that — as long as they’re not all calling each other :wink:

But even hints of what might be happening when it crashes can be useful.

One thing to keep in mind. When you’re scripting InDesign, each command normally gets added to the undo stack. So if you do get a crash, sometimes just checking what the last undo (or two) is in InDesign can give you an idea where a script got to when it crashed.

1 Like

Thanks Shane! I knew I would get a reaction :innocent:
Will keep the undo tip in mind! Maybe there is a way to clear the undo history? Or that only by doing a save As of the document.

I’ve got a habit of importing the library in itself so instead of doing a my callHandler in the library sLibHelper, I use sLibHelper's callHandler, at the top I put the statement
use sLibHelper : script "LIB_Helper_0201r.scpt" without importing. just the same statement I put in my calling script.
This way when I have to debug the library I can just move that handler to the calling script without changing that statement.

Maybe I oversee a way to debug a library from within the calling script?

In case this helps, based on the crash reports I suspect the problem is a value stored in a variable. It could be that InDesign is returning a malformed value which is causing AppleScript to crash.

I also had a feeling that sometimes when properties that are returned by InDesign becomes too large and make SD crash in debugging mode.

Hello Mark,
is there a way to not show the results when debugging? It’s only to get a hold on the script flow of if’s and then’s.
The only option I know is to completely set the results off in the preferences.
Maybe it would be possible to toggle it on or off when debugging?

It is just a thought :slight_smile: :face_with_monocle:

You can show the Resources Tab or Inspectors Tab instead.

But then SD still collects the results?
Is there a difference in memory or memory that SD has to do then?

Yes. But it’s quite possible the problem comes from trying to display a malformed value, rather than merely receiving it.

At the very least, doing this may help track down where the problem is happening.

Thanks Shane,
As a long time SD user, I may say that, I didn’t know that when you showed resources you still get a result from the line before your breakpoint at the top of your windowpane.
You’ll never too old to learn. :building_construction: