Alert message before exporting PDF
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Alert message before exporting PDF
Tagged: Alert, PDF export, Pop-Up Message
- This topic has 16 replies, 4 voices, and was last updated 5 years, 1 month ago by Lukáš Záleský.
-
AuthorPosts
-
-
January 12, 2017 at 3:10 am #91193Masood AhmadParticipant
Hello Everyone,
A very Happy New Year to you all :)
Is it possible to have an Alert Message (with OK and Cancel buttons) when the user exports a PDF either by cmd+E or by File>Export option.
The message can be like this:
Have you check the file thoroughly before exporting the PDF?
OK
Cancel
Clicking on the Cancel button will cancel the export.
OK button will export the PDFJavaScript is preferable. AppleScript can also work.
Thanks in advance.
Masood Ahmad
-
January 13, 2017 at 5:34 am #91229Masood AhmadParticipant
Did I asked too much or is this impossible to achieve??
-
January 13, 2017 at 7:13 am #91235David BlatnerKeymaster
It’s a good idea, but I don’t know any way to make InDesign do that. Maybe with APID from Rorohiko?
-
January 13, 2017 at 8:07 am #91241Masood AhmadParticipant
I too have the same thought but I’m sure people like Peter, Keith or Jongware can do that.
It’s a big challenge…
-
January 13, 2017 at 9:20 am #91244Kai RübsamenMember
Try this one and put it in a start up folder. The alert will only have a yes and no. Maybe ok and cancel is possible with script-ui.
#targetengine "doSomethingInCase" app.addEventListener("beforeExport", onExport); function onExport(event) { var result = confirm("Have you check the file thoroughly before exporting the PDF?", true, "WARNING"); if (result == true) { return }; else (result == false) { event.stopPropagation(); event.preventDefault(); }; return; }
Kai
-
January 16, 2017 at 4:40 am #91261Masood AhmadParticipant
Hi Kai,
Hope you’re well and had a great weekend.
Being a non-programmer, I’m trying to learn “JavaScript for InDesign” from a very long time. I have searched the web but didn’t get anything that can teach me the same. I have also gone through the course “InDesign-Scripting-Made-Easy” by Keith on Lynda, but fails to understand it. I then took a course in JavaScript, HTML and CSS from a reputed Institute. There I learned about the Web and the basics of JS. The instructors over there were unaware about the InDesign DOM and hence I’m left with no knowledge about the course I’m looking for.
The Keith’s course gives the basic idea about the DOM but not in depth. For example, how to read DOM, how to capture the commands and options from DOM and utilize them in the JS. There is a huge .chm version of the DOM by Jongware, I have downloaded it but unable to read/understand it.
Can you please guide me and recommend something in this regard. Meanwhile, I’m trying to get in touch with some Programmers, who are working on InDesign JavaScript.
Thanks in advance,
Masood
-
January 16, 2017 at 5:29 am #91262Kai RübsamenMember
Hi Masood,
there exists always two kind of people: Graphic designers and scripters. Unfortunately most books and courses are written by scripters. So sometimes very dry stuff and hard to understand. I’m a graphic designer. So if I have problems, I have problems with JS and not the DOM ;-)
To get a good start, I can recommend Peter Kahrels guide: https://shop.oreilly.com/product/9780596802530.do
Allthough this isn’t up to date, it covers all important parts.Then Grant Gamble: https://www.amazon.de/InDesign-CS5-Automation-Using-JavaScript/dp/1460915380
And at least: The Javascript course at lynda.com from Simon Allardice
Notice one big thing:
You cannot read those books from start to finish. There will always be a situation, where your script goes wrong or you do not understand what the author is tryin’ to say you. This time, the indesignsecrets or adobe-scripting forum is your friend, where you can post your code and people will give you in short an answer.hth
kai -
January 16, 2017 at 7:32 am #91267Masood AhmadParticipant
Thanks Kai, for your suggestions. I’ll go through these and hope to have a good start.
-
-
January 13, 2017 at 10:32 am #91245Masood AhmadParticipant
Million thanks for a quick solution. This is exactly I was looking for.
It’s good to have so much talented people in this community.
Once again many thanks.
-
December 7, 2018 at 9:55 am #112589Masood AhmadParticipant
Hi @Kai Rübsamen,
Can the script be updated to work in Illustrator as well. I didn’t find Startup Scripts folder in illustrator.
I want a pop-up message on Export and Close. Can you please look into this once again and suggest something.Thanks in advance!
Masood -
December 7, 2018 at 10:59 am #112592Kai RübsamenMember
Masood, sadly I’m not familiar with scripting in Illustrator, cause Illustrator has another object modell than InDesign.
-
December 10, 2018 at 6:13 am #112739Masood AhmadParticipant
Thanks Kai for responding back. I’ve uploaded the post on Adobe as well, let’s see what I’ll get.
-
January 16, 2019 at 7:20 am #113680Masood AhmadParticipant
Hi @Kai Rübsamen,
Hope you’re well.
Sorry to bother you again. But I need your help to refine the below code.
I was looking for a script to run spell check before closing a file. So with some help from my colleague and using your code we created a code that is filling our requirements.
I also tried to get some help from Adobe but there’s no response. So I have to come back to my favourite team.
https://forums.adobe.com/thread/2521329The code is working fine i.e.
a) A message pops-up when a user closes a file;
b) If the user press No, then it open the Spell-Check dialog box;
c) If the user press Yes, then the file gets closed; BUT
d) It pops-up another message with Yes/No.Can the last pop-up message be disabled. Any help would be much appreciated.
#targetengine "Reminder to run the Spell Check before Closing a file"app.addEventListener("beforeClose", onClose);
function onClose(myEvent) {
var result = confirm("Have you run the Spell-Check?", true, "WARNING");if (result == true) {
return
};else (result == false) {
myEvent.stopPropagation();
myEvent.preventDefault();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
app.menuActions.item("Check Spelling...").invoke();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
};
}
-
January 17, 2019 at 11:09 am #113711Masood AhmadParticipant
Any Luck :)
-
January 30, 2019 at 6:24 am #114026Masood AhmadParticipant
We further refine the script. The only problem I can see is that it either runs successfully on one system and only run once on another system. While troubleshooting, I noticed that if a user selects “Yes”, then the script don’t run the second time.
Can anyone help me improve the script. Thanks in advance.
#targetengine "inDesign"app.addEventListener("beforeClose", onClose);
function onClose(e) {
var result = confirm('Have you run the Spell-Check?', true, "WARNING");
if (result == true) {
app.eventListeners.everyItem().remove();
return
}else(result == false) {
e.stopPropagation();
e.preventDefault();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
app.menuActions.item("Check Spelling...").invoke();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
}
-
February 14, 2019 at 12:09 pm #114389Lukáš ZáleskýParticipant
If you use Windows, it’s easy to write a simple script like this one
https://drive.google.com/open?id=1ssNOSW65Eb6AT3_6kw8ea3U62kcw65DU
And it is easy to prepare for both AI and Indd-
February 14, 2019 at 12:25 pm #114399Lukáš ZáleskýParticipant
I’m sorry, here’s a new link with a repaired video (i dont know how to edit my post):
https://drive.google.com/open?id=1IZUQvMqwEX9_8CZOGqbZ3tfW0vpa4qOZ
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.