Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JS][CS3] Print DIalog Box with ESCAPE

Guest
Feb 26, 2009 Feb 26, 2009
I am using document.print(true) in my script.

Is there a way to catch if the user pressed "CANCEL"? So I can keep track of how many prints were "skipped"
Thank you, Alex.
TOPICS
Scripting
957
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2009 Feb 27, 2009
Unfortunately,
i print
has a prototype

>void print ([printDialog:bool][, using:any])

where the 'void' indicates it does not return a value.

I wonder if this can be wrapped by the CS4 Event object. That has properties 'cancelable' (if true, cancelling is allowed) and 'defaultPrevented' (if true, default behavior has been cancelled). Idle rambling, because 1. I have no idea at all how to work with Events, 2. most likely, ID does not 'update' the current Print dialog to

>[..] keep track of how many prints were "skipped"

(i.e., you still won't know where it was), and 3. I don't even know if you have CS4, or an older version.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 27, 2009 Feb 27, 2009
I have CS3, topic [JS][CS3].
I am looping through documents being batched. So each time the print dialogue would return "null" for a cancel, I would know that document was skipped.
Unfortunately, like you said print has no return value.

Would there be a way to test the last keystroke?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 27, 2009 Feb 27, 2009
Rorohiko's APID has docPrinted event (sent after the document was printed).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 27, 2009 Feb 27, 2009
Nothing on the InDesign side?
Otherwise it would mean another purchase/plug-in but most annoyingly an install. We're on tight "security" restriction here...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 27, 2009 Feb 27, 2009
It's indispensable tool for everybody who is serious about scripting.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2009 Feb 28, 2009
Kasyan_Servetsky@adobeforums.com wrote:
> It's indispensable tool for everybody who is serious about scripting.
>

I second that!

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 02, 2009 Mar 02, 2009
I went on the website looking for "DocPrinted" but did not find an API plug-in related to printing. I've sent an email to their support with the same question. No response yet.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 03, 2009 Mar 03, 2009
Alexandre,

I was referencing to the Active Page Item Developer plug-in. You can read detailed information about it and download demo version here: http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/

Kasyan
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2009 Mar 04, 2009
Just a quick illustration of how useful APID is:

My wife still uses CS2 at work. We have a Riso digital duplicator which
we use for printing booklets, invitations, etc. When printing from
InDesign to the Riso machine, color management must be off or the blacks
get printed as dark gray (about 95% line screen). Well, I tried to help
out by printing a booklet, and like usual, I messed up and forgot to
turn off color management. (I'm really good at messing things up!) ;)

I decided to put an end to this problem, and create a solution which
would always cause InDesign to send to this printer (only) with color
management turned off. It took me a total of maybe 15 minutes...


// DontManageColorForRiso.jsx
// This script should be in the same folder as the document
DontManageColorForRisoSourceCS4.indd
// It is automatically called by the DontManageColorForRisoController
page item.
//events: docPrintConfigured,docPrinted
// Header - matches anonymous function trailer at bottom
(function(thePlugin)
{
main();
function main(){
var theEventCode = thePlugin.eventCode;
var doc = GetDocFromPageItem(thePlugin);
switch(theEventCode){
case "docPrintConfigured":TurnOffColorManagement(doc);break;
case
"docPrinted":app.colorSettings.enableColorManagement=true;break;
}
}
function TurnOffColorManagement(doc){
var printer = doc.printPreferences.printer;
if(printer.constructor.name!="String"){return}
printer=printer.toLowerCase();
if(printer.match(/riso/)){
app.colorSettings.enableColorManagement=false;
}
}
function GetDocFromPageItem (pageItem){
var guid = app.callExtension(0x90B6C,10014,pageItem);
return app.callExtension(0x90B6C,10009,guid);
}
// Trailer - matches anonymous function header at top
}
)(theItem);

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 04, 2009 Mar 04, 2009
LATEST
Marveleous tools. I would not be able to do that fix in 15 min!

The event handler sounds a lot like InEventScript plug in.
The later has not been transported to CS3 since CS3 handles events.

But it seems API is a little more thorough in its functions!

One downfall is I have to struggle w/ limited user privilege and installing anything is restricted. If in their good graces I fall...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines