Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PlaceSnippetFromClipboard()
- function PlaceSnippetFromClipboard(){
- var doc = app.documents[0];
- if (!doc) {
- alert("No document is open or the ExtendScript editor is not connected to InDesign");
- return true;
- }
- doc.textPreferences.typographersQuotes = false;
- var tf = doc.textFrames.add();
- var story = tf.parentStory;
- //story.appliedLanguage = app.languagesWithVendors[0];
- story.insertionPoints[0].select();
- app.paste();
- var str = story.contents;
- if (str.indexOf("‚Äú")!=-1 || str.indexOf("Äù")!=-1 || str.indexOf("‚Äô")!=-1) {
- alert("Weird quotes were found. Try saving to an .idms file and then placing it.");
- //str = str.replace("”", '"');
- //alert(str.substr(0,200));
- }
- //alert(str);
- tf.remove();
- var f = File(Folder.temp + "/temp_snippet.idms");
- f.encoding = "UTF-8";
- f.open('w');
- f.write(str);
- f.close();
- doc.place(f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement