What can I do if the script runs faster than the network?

I wrote a script between applications moving to InDesign, where he begins to AppleScript, to Photoshop, which AppleScript runs a JavaScript script to perform various tasks.

It works beautifully on my laptop at home where I do my development. Yesterday, using me as a Guinea pig, I tried it in the office.

On the third round, I was horrified to see the ExtendScript Toolkit pop up with an error message (about as welcome to see an AppleScript script, asking the user to open the Script Editor and fix a script).

The error message was that app.bringToFront (); was not a valid function.

This was the case in InDesign, which has a different activation function, and I realized that, even if my AppleScript called Photoshop activate, I was still in InDesign.

The app.bringToFront JavaScript was so called because I had joined my code in the model of Tranberry.

So I pressed the button stop on ExtendScript, returned to InDesign and represented the script. This time he worked as usual.

Occasionally on our network we spend some time beachball - watch as a communication happens in the background. So I guess the time wherever the error was thrown was on one of these downturns in the network.

The passage of InDesign, Photoshop is not happening pretty fast, but the script has run and has issued an order Photoshop JavaScript while I was still in InDesign.

In AppleScript this unhappy communication with users can be avoided using blocks '... try error'.

Is there an equivalent of the error handling in JavaScript that would allow me to avoid being tossed in the ExtendScript Toolkit and give them a friendly message to apologize, explaining what had happened and inviting them to try again?

JavaScript has try/catch blocks

try {}

app.bringToFront ();

} catch (e) {}

error handling code

}

Or you might be able to use an if statement

If (app == 'photoshop') {}

app.bringToFront ();

} else {}

app handle not photoshop

}

Tags: Photoshop

Similar Questions

Maybe you are looking for