Forum Replies Created
-
AuthorPosts
-
November 24, 2022 at 11:38 pm in reply to: problem importing illustrator Interlace into indesign #14375128
Magnus Gaarde
MemberI am getting the pixelation too even when placing the AI file in inDesign.
To get it to work go back to Illustrator and then: Object > Expand and resave.April 29, 2022 at 12:30 pm in reply to: Convert Footnotes and Endnotes bug + bonus scripting bug #14364995Magnus Gaarde
MemberFor anyone interested the script below will insert footnote numbers back into all footnotes.
var scriptName = File($.fileName).name;
app.scriptPreferences.enableRedraw = false; //Does not seem to work in this caseApplication.prototype.main = function() {
var theDoc = app.activeDocument;
var theStory;
try{
theStory = app.selection[0].parentStory;
}
catch(e)
{
alert("Place cursor i story with footnotes and try again");
exit();
}
var theFootnotes = theStory.footnotes.everyItem().getElements();
var theCounter = 0;//progressbar setup
var w = new Window('palette', 'Inserting footnote numbers ...', {x:200, y:200, width:350, height:70});
w.pbar = w.add('progressbar', {x:25, y:12, width:300, height:12}, 0, theFootnotes.length);
w.st = w.add('statictext', {x:10, y:36, width:320, height:20}, '');
w.st.justify = 'center';
w.show();//new temporary footnote
var tempNote = theStory.insertionPoints[-1].footnotes.add();//Select and copy text from the temp footnote
var theFootnoteNumber = tempNote.texts[0]; //includes both the number and the following tab character
app.select(theFootnoteNumber);
app.copy();// remove temp footnote
tempNote.remove();//iterate existing footnotes and insert footnotenumber
for (var i = theFootnotes.length-1; i >= 0 ; i--) {
app.select(theFootnotes[i].paragraphs[0].insertionPoints[0]);
app.paste();
theCounter++;
w.pbar.value = theFootnotes.length-i;
w.st.text = "Processing item " + w.pbar.value + " of " + theFootnotes.length + " total";
}
alert("Inserted footnote number in " + theCounter + " footnotes.");
}
app.doScript('app.main();',ScriptLanguage.JAVASCRIPT,undefined,UndoModes.ENTIRE_SCRIPT,scriptName);
April 26, 2022 at 11:19 pm in reply to: Convert Footnotes and Endnotes bug + bonus scripting bug #14364891Magnus Gaarde
MemberDang! That block quote tag sure is effective. Sorry for screaming.
Magnus Gaarde
MemberHi
In stead of using .+? which is greedy
try using .*?Magnus Gaarde
MemberYes, Theunis
activePage is a handy property for getting that one specific page.
The only thing that bothers me about this is that if you have your zoom fit to spread then the active page is automatically set to the left one. Even if you have a selection on the right hand page. To make the right hand page the active one I must move the spread a bit to the left.
It could be that I am doing something wrong, but this has bothered me so much that I would rather get the current page from a selection on the page.Magnus Gaarde
MemberThere is also the parentPage property of a textFrame. Handy if your script is looping through many pages .
For instance this :
var currentPage = myParagraphs[i].parentTextFrames[0].parentPage;
would set the currentPage variable to the page of the paragraph’s initial insertionPoint.
In much the same manner you could find the current page of a character, a textstyle range, a footnote, a note, an anchored object etc.
November 25, 2019 at 6:12 am in reply to: Make an array of H&J violations for processing with script #14323525Magnus Gaarde
MemberHmmm,
I found the width of an unjustified space by finding the horizontalOffset.November 25, 2019 at 5:58 am in reply to: Make an array of H&J violations for processing with script #14323526Magnus Gaarde
MemberHi Peter
Thanks for the answer. I was afraid that would be the case.
How would you go about picking up the width of a character?
Magnus Gaarde
MemberHi William
You must move the parent of the graphic and not the graphic itself. The parent is the frame containing the graphic.
And then I believe you need to loop through each of them to do so. (Maybe there is a smarter way than looping.)var theDoc = app.activeDocument;
var theGraphics = theDoc.allGraphics;if(!theDoc.layers.item (“images”).isValid){
var imgLayer = theDoc.layers.add({name:”images”}); //adding layer if it is not present
}
else {
var imgLayer = theDoc.layers.item(“images”);
}for (var i = 0; i < theGraphics.length; i++) {
theGraphics[i].parent.itemLayer = imgLayer;
}Magnus Gaarde
MemberI have actually just written this script to accomplish what you asked for:
Application.prototype.main = function() {
if (!app.documents.length < 1 ){
var theDoc = app.documents[0];
var theParagraphStyles = theDoc.allParagraphStyles;
}
else{
alert(“You need an open document to run this.”);
exit();
}var myDialog = app.dialogs.add({name:”Change global language in all paragraph styles”, canCancel:true});
var myLanguages = app.languagesWithVendors.everyItem().name.sort();
myLanguages.splice (0,0, myLanguages[myLanguages.length-1]);
myLanguages.pop();try{
with(myDialog)
{
with(dialogColumns.add())
{with(borderPanels.add())
{
staticTexts.add({staticLabel:”Change language to “});
var myLanguagesDropDown = dropdowns.add({stringList:myLanguages, selectedIndex:0});
staticTexts.add({minWidth:25});
}}
}// End of the dialog box}//End of try
catch(e){alert(e + ” Just another error”);}var myResult = myDialog.show();
if(myResult == true){
for (var i=1;i<theParagraphStyles.length;i++){
theParagraphStyles[i].appliedLanguage = myLanguages[myLanguagesDropDown.selectedIndex];
}
}
else{
exit();
}
}
app.doScript(‘app.main();’,ScriptLanguage.JAVASCRIPT,undefined,UndoModes.ENTIRE_SCRIPT, “Change language in all paragraphstyles”);Magnus Gaarde
MemberHmmm… yeah that fixed it.
For now, I guess.
It has been years since I had to clear the prefs. Maybe I should do it more often :-)
Magnus Gaarde
MemberThanks, Eugenyus
Yes that kind of works.
But it does not work very well in paragraphs where hyphenation is off. I get some very short lines now because of some words being pulled down to the next line. Is the hair space a non breaking character?I would still like to be able to swap the anchor marker and the space before it. That gives me the best result in all situations here.
-
AuthorPosts
