/////////////////////////////////////////////////////// // This script helps to import text styles from one PageMaker document to another. // Script always imports styles to the front document from any other currently opened // document. Script allows to select one or several styles from all styles in // currently opened documents, excluding front document which is a target. // Invoke his script when two or more PageMaker documents are opened. // Script allows to open additional PageMaker documents to choose style from. /////////////////////////////////////////////////////// getscriptver >> ver if empty(ver) message "Sorry, the script can not run on this version of the script engine." return endif if ver < 3.5 message "Sorry, the script can not run on this version of the script engine." return endif /////////////////////////////////////////////////////// "Import" = "Import" // to localize change right side of this assignment. getpubwindows >> N,winlist if N<2 message "This script can import text styles from opened ( but not active ) documents" message "into the front document." message "To import text styles:" message "1) open all source documents" message "2) open the destination document, thus bringing it to front." message "3) Invoke this script." return endif getpubname >> name foreignStyles = loop n = 1,N continue name = winlist(n) window winlist(n) getstylenames >> S,styles loop s = 1,S foreignStyles = foreignStyles,winlist(n) + " :: "+styles(s) endloop endloop window name repeat dialogbegin -120,-100,120,60,"Import Styles" listboxmulti 5,5,235,100,foreignStyles pushbutton 35,128,100,150,"Import" pushbutton 5,100,235,120,"Browse documents" callback Browse pushbutton 140,128,205,150,"Cancel" dialogend >> bHit,importList,... if not(bHit = "Import") return endif until bHit = "Import" importList = unquote(importList) YesToAll = 0 NoToAll = 0 while not(empty(importList)) set importList >> style,importList set style/" :: " >> doc,style window doc stylebegin style getalignment >> alignment getcase >> case getcolor >> color getfont >> font gethyphenation >> hyphenation getindents >> indents getkern >> kern getleading >> leading getletterspace >> letterspace getparaspace >> paraspace getparaoptions >> paraoptions getruleabove >> ruleabove getrulebelow >> rulebelow getruleoptions >> ruleoptions getsize >> size getspaceoptions >> spaceoptions gettabs >> tabs gettypeoptions >> typeoptions gettypeposition >> typeposition gettypestyle >> typestyle gettrack >> track getwidth >> width getwordspace >> wordspace styleend window name getstylenames >> existingStyles if (style # existingStyles) if (YesToAll+NoToAll=0) dialogbegin -120,-50,130,0,"Alert" static 5,5,235,20,"Style '" + style + "' already exists in the document. Replace?" pushbutton 20,20,60,40,"Yes" pushbutton 70,20,110,40,"No" pushbutton 120,20,170,40,"Yes to all" pushbutton 180,20,230,40,"No to all" dialogend >> bHit,... elseif YesToAll bHit = "Yes" elseif NoToAll bHit = "No" endif continue not (bHit = "Yes") endif stylebegin style alignment alignment case case hyphenation hyphenation indents indents leading leading letterspace letterspace paraspace paraspace paraoptions paraoptions ruleabove ruleabove rulebelow rulebelow ruleoptions ruleoptions size size spaceoptions spaceoptions tabs tabs typeoptions typeoptions position typeposition // typestyle typestyle track track setwidth width wordspace wordspace set typestyle >> ...,t typestyle normal if t>1 set trunc(t/2) >> t if t>63 typestyle reverse set t-64 >> t endif if t>31 typestyle shadow set t-32 >> t endif if t>15 typestyle outline set t-16 >> t endif if t>7 typestyle strikethru set t-8 >> t endif if t>3 typestyle underline set t-4 >> t endif if t>1 typestyle italic set t-2 >> t endif if t typestyle bold endif endif styleend stylebegin style try font font try styleend stylebegin style try color color try styleend endwhile return sub Browse getdefaultdir >> defdir getpanestate 1 >> PS opendialog defdir,"PageMaker Document","*.p65" >> f if not(f="") try open f getstylenames >> N,styles newListItems = loop n = 1,N newListItems = newListItems,f+" :: "+styles(n) endloop window name setpanestate 1,newListItems,PS endif endsub