Forum Replies Created
-
AuthorPosts
-
Alain Bolduc
ParticipantLike I said, I’m not a script expert. I grab the same script here ! But managed to combine it with another one to make it save on the desktop.
From what I experience, as long as the text box that will give the name of the files has to stylised with the “filename” style, it should work.
In my case, I use something like this : [number##_150x90px], [number##_300x250px], etc. And I do a find and replace for the “number##” value.
But I used this procedure for a 14 pages document that is pre-formatted… I guess if the Insert Current Page is also stylised, it should work… but I didn’t tried.Alain Bolduc
ParticipantHere’s the script I’ve been using and it’s working great. I’ve managed to have the JPG saved on my desktop though, not in a specific folder.
I’ve changed the resolution to 300 dpi…
Also, the script is looking for the Paragraph style “filenames”. As long as the text box for the names is set with that style, I think it will work, but I ain’t an expert!
Hope this can help.
if (app.documents.length != 0){
var myDoc = app.activeDocument;
MakeJPEGfile();
} else {
alert("Please open a document and try again.");
}
function myPS() {
try {
return myDoc.selection[0].appliedParagraphStyle;
} catch (e) {
alert("Place cursor to text with paragraph style for filenames");
exit();
}
}
function MakeJPEGfile() {
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 300;
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
app.findGrepPreferences = null;
app.findGrepPreferences.appliedParagraphStyle = myPS();
var f = myDoc.findGrep();
for (var myCounter = 0; myCounter < f.length; myCounter++) {
try {
var curPage = f[myCounter].parentTextFrames[0].parentPage;
if (curPage.appliedSection.name != "") {
curPage.appliedSection.name = "";
}
var objName = f[myCounter].contents.replace(/ /g,"_").toLowerCase();
app.jpegExportPreferences.pageString = curPage.name;
var myFilePath = "~/Desktop/" + "/" + objName + ".jpg"; //export to a folder of the current document
var myFile = new File(myFilePath);
myDoc.exportFile(ExportFormat.jpg, myFile, false);
}
catch(e){}//pasteboard?
}
}
Alain Bolduc
ParticipantThanks so much! This is perfect
Is there a way for the scrip to ask user to create a folder on the desktop than saving into that folder?
Alain Bolduc
ParticipantThis is exactly what I need… except I would like to export to a specific dossier or desktop. Possible?
-
AuthorPosts
