Article View: adobe.scripting.indesign
Article #9938Re: Exit from script
From: Dave_Saunders
Date: Thu, 13 Jul 2006 13:27
Date: Thu, 13 Jul 2006 13:27
24 lines
2885 bytes
2885 bytes
Here are some notes I made about this function and a few others: alert(s) Pops up an alert that displays the string s; if necessary, JavaScript coerces the argument to a string before displaying it. There is an OK button for dismissing the alert. On Mac systems, if there is more than one line of text in s (use '\n' to terminate lines), the first line is boldened in the alert (this appears to be some kind of Mac OS feature for alerts and not any indication of platform bias in the InDesign JavaScript). Returns nothing, the script simply continues. confirm(s, [b]) Pops up an alert that displays the string s along with a No and Yes button. You have no control over the naming of the two buttons, so you need to construct the string to ask an appropriate question. The optional boolean argument b determines which button is the default. If false or absent, the Yes button is the default; if true, the No button is the default. While the s argument would be coerced if necessary, it makes very little sense to use anything other than a carefully composed string when using this function. Returns true if Yes is pressed, false if No is pressed. prompt(s, [s1], [s2]) Pops up an alert that allows the user to provide a value to a script. The alert displays a title derived from the optional string argument s2 (if absent, title reads: 'Script Prompt'), a message from the string argument s, and a default value from the optional string argument s1 (if absent, an empty string is displayed in the text box). The alert has two buttons, OK and Cancel. Returns the edited string if OK is pressed or null if Cancel is pressed. Usage Notes (for above three functions) * These alerts are displayed by the target application, so if you're running a script that targets InDesign from ESTK, it's a good idea to immediately precede any of these calls with app.activate(), otherwise the alert might appear behind the ESTK window. * These alerts are not affected by the state of app.scriptPreferences.userInteractionLevel. beep() Issues a system beep. This function was introduced with InDesign CS2. exit() Immediately exits the running script no matter how deeply the call might be inside nested function calls. In CS, this also issued a beep; CS2 exits silently. Dave
Technical Details
Message-ID:
<3bc0e627.3@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.motzarella.org!news.ecp.fr!news.stben.net!webcrossingReferences:
<3bc0e627.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b8b7aede73e89ca3 X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Exit from script Message-ID: <3bc0e627.3@webcrossing.la2eafNXanI> Date: Thu, 13 Jul 2006 06:27:19 -0700 References: <3bc0e627.-1@webcrossing.la2eafNXanI> Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.motzarella.org!news.ecp.fr!news.stben.net!webcrossing