Skip to main content
May 4, 2014
Question

Terminate (VB)Script early

  • May 4, 2014
  • 1 reply
  • 401 views

Hi,

is there a simple possibility to end a VB-Script for Indesign (e.g. in a case of error)? The Problem is, that Indesign doesn't use the Windows Script Host to exectute the script, so the standard procedure Wscript.End() doesnt work.

Thanks!

This topic has been closed for replies.

1 reply

pixxxelschubser
Community Expert
Community Expert
May 4, 2014

Hello Friedrich_Nietzsche,

I don't know, how the right way in VBS is. Sorry.

But IMHO InDesign ExtendScript (JS) knows the exit() command.

This problem really exists in Illustrator JS. The only way to catch there an error is to use if/else and try/catch clauses and a lot of functions.

May 4, 2014

Hi, thanks for your answer. Again

Unfortunately I've tried all these and similar options (End, quit and so on), none of them seems to work. I've thought about using If conditions, but since the script is quite large, I try to keep it as simple as possible. Maybe someone knows a possibility. If not, I have to work with if conditions.

pixxxelschubser
Community Expert
Community Expert
May 4, 2014

Hmmh?

This JavaScript works with InDesign:

if (!app.documents.length) {

    alert("cancelled");

    exit();

    alert("Note: You will never see this alert.");

    } else {

        alert("open documents: " + app.documents.length);

        // your stuff

        }

And I think this should be (translated) also possible with VBS .