0 Replies Latest reply on Aug 20, 2015 5:03 AM by Eric Lipton Ice

    Overzicht maken actieve fonts in Indesign via Applescript

    Eric Lipton Ice Level 1

      Ik wil bij deze een script delen. Het script maakt een overzicht van alle beschikbare fonts in InDesign. Er zijn meer scripts te vinden die dit doen, maar die voldeden niet voor mij. Voorheen werkte fontgander perfect, maar dat was systeem 9. Ik heb tot op heden nog niets vergelijkbaars gezien voor OSX. Uit ontevredenheid geboren dus dit script. Enjoy!

       

      tell application "Adobe InDesign CS6"

          activate

          set myFontList to get name of fonts as string

          set mydoc to make document

          tell document 1 to tell document preferences

              set pages per document to 1

              set page orientation to landscape

              set page width to "210 mm"

              set page height to "297 mm"

              set facing pages to false

          end tell

          tell master spread 1 of mydoc to tell margin preferences of pages

              set top to 5.5

              set left to 5.5

              set bottom to 5.5

              set right to 5.5

              set column count to 5

              set column gutter to 3

          end tell

          set find text preferences to nothing

          set change text preferences to nothing

          set find what of find text preferences to "    "

          set change to of change text preferences to " "

          set transform reference point of layout window 1 to top left anchor

          zoom layout window 1 given fit page

      end tell

       

      set nBrs to count myFontList

      set nTal to nBrs / 25

      round nTal rounding up

       

      set sampleText to "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 ( ! ? ; ” & @ ] }"

      set f to 1

      set xPage to 1

       

      repeat nTal times

          set b1 to 5.5

          set a1 to 5.5

          set b2 to 8.5

          set a2 to 42.9

          set b3 to 9.5

          set a3 to 5.5

          set b4 to 59.5

          set a4 to 42.9

          repeat 5 times

              tell application "Adobe InDesign CS6" -- [rij 1:]

                  tell page xPage of document 1

                      set xFrame01 to make text frame with properties {geometric bounds:{b1, a1, b2, a2}, fill color:color id 11, contents:(item f of myFontList), text frame preferences:{vertical justification:center align}}

                      delay 0.25

                      tell xFrame01 to tell paragraph 1

                          set applied font to "DINCond    Medium"

                          set point size to 5.5

                          set fill color to color id 15

                          set left indent to 1.0

                          set right indent to 0.5

                          set baseline shift to 0.5

                      end tell

                      set xFrame02 to make text frame with properties {geometric bounds:{b3, a3, b4, a4}, fill color:color id 14, contents:sampleText, text frame preferences:{vertical justification:justify align, auto sizing type:height and width proportionally, auto sizing reference point:top left point}}

                      tell xFrame02 to tell paragraph 1

                          set applied font to (item f of myFontList)

                          set point size to 27.712

                          set leading to 25.697

                          set fill color to color id 11

                          set justification to fully justified

                          set kerning method to "Optisch"

                          set tracking to -125

                          set composer to "Adobe Composer alinea"

                          set name of xFrame02 to "sampleText"

                      end tell

                  end tell

              end tell

              set b1 to b1

              set a1 to a1 + 40.4

              set b2 to b2

              set a2 to a2 + 40.4

              set b3 to b3

              set a3 to a3 + 40.4

              set b4 to b4

              set a4 to a4 + 40.4

              set f to (f + 1)

          end repeat

          set d1 to 63.5

          set c1 to 5.5

          set d2 to 66.5

          set c2 to 42.9

          set d3 to 67.5

          set c3 to 5.5

          set d4 to 117.5

          set c4 to 42.9

          repeat 5 times

              tell application "Adobe InDesign CS6" -- [rij 2:]

                  tell page xPage of document 1

                      set xFrame01 to make text frame with properties {geometric bounds:{d1, c1, d2, c2}, fill color:color id 11, contents:(item f of myFontList), text frame preferences:{vertical justification:center align}}

                      delay 0.25

                      tell xFrame01 to tell paragraph 1

                          set applied font to "DINCond    Medium"

                          set point size to 5.5

                          set fill color to color id 15

                          set left indent to 1.0

                          set right indent to 0.5

                          set baseline shift to 0.5

                      end tell

                      set xFrame02 to make text frame with properties {geometric bounds:{d3, c3, d4, c4}, fill color:color id 14, contents:sampleText, text frame preferences:{vertical justification:justify align, auto sizing type:height and width proportionally, auto sizing reference point:top left point}}

                      tell xFrame02 to tell paragraph 1

                          set applied font to (item f of myFontList)

                          set point size to 27.712

                          set leading to 25.697

                          set fill color to color id 11

                          set justification to fully justified

                          set kerning method to "Optisch"

                          set tracking to -125

                          set composer to "Adobe Composer alinea"

                          set name of xFrame02 to "sampleText"

                      end tell

                  end tell

              end tell

              set d1 to d1

              set c1 to c1 + 40.4

              set d2 to d2

              set c2 to c2 + 40.4

              set d3 to d3

              set c3 to c3 + 40.4

              set d4 to d4

              set c4 to c4 + 40.4

              set f to (f + 1)

          end repeat

          set f1 to 121.5

          set e1 to 5.5

          set f2 to 124.5

          set e2 to 42.9

          set f3 to 125.5

          set e3 to 5.5

          set f4 to 175.5

          set e4 to 42.9

          repeat 5 times

              tell application "Adobe InDesign CS6" -- [rij 3:]

                  tell page xPage of document 1

                      set xFrame01 to make text frame with properties {geometric bounds:{f1, e1, f2, e2}, fill color:color id 11, contents:(item f of myFontList), text frame preferences:{vertical justification:center align}}

                      delay 0.25

                      tell xFrame01 to tell paragraph 1

                          set applied font to "DINCond    Medium"

                          set point size to 5.5

                          set fill color to color id 15

                          set left indent to 1.0

                          set right indent to 0.5

                          set baseline shift to 0.5

                      end tell

                      set xFrame02 to make text frame with properties {geometric bounds:{f3, e3, f4, e4}, fill color:color id 14, contents:sampleText, text frame preferences:{vertical justification:justify align, auto sizing type:height and width proportionally, auto sizing reference point:top left point}}

                      tell xFrame02 to tell paragraph 1

                          set applied font to (item f of myFontList)

                          set point size to 27.712

                          set leading to 25.697

                          set fill color to color id 11

                          set justification to fully justified

                          set kerning method to "Optisch"

                          set tracking to -125

                          set composer to "Adobe Composer alinea"

                          set name of xFrame02 to "sampleText"

                      end tell

                  end tell

              end tell

              set f1 to f1

              set e1 to e1 + 40.4

              set f2 to f2

              set e2 to e2 + 40.4

              set f3 to f3

              set e3 to e3 + 40.4

              set f4 to f4

              set e4 to e4 + 40.4

              set f to (f + 1)

          end repeat

          set h1 to 179.5

          set g1 to 5.5

          set h2 to 182.5

          set g2 to 42.9

          set h3 to 183.5

          set g3 to 5.5

          set h4 to 233.5

          set g4 to 42.9

          repeat 5 times

              tell application "Adobe InDesign CS6" -- [rij 4:]

                  tell page xPage of document 1

                      set xFrame01 to make text frame with properties {geometric bounds:{h1, g1, h2, g2}, fill color:color id 11, contents:(item f of myFontList), text frame preferences:{vertical justification:center align}}

                      delay 0.25

                      tell xFrame01 to tell paragraph 1

                          set applied font to "DINCond    Medium"

                          set point size to 5.5

                          set fill color to color id 15

                          set left indent to 1.0

                          set right indent to 0.5

                          set baseline shift to 0.5

                      end tell

                      set xFrame02 to make text frame with properties {geometric bounds:{h3, g3, h4, g4}, fill color:color id 14, contents:sampleText, text frame preferences:{vertical justification:justify align, auto sizing type:height and width proportionally, auto sizing reference point:top left point}}

                      tell xFrame02 to tell paragraph 1

                          set applied font to (item f of myFontList)

                          set point size to 27.712

                          set leading to 25.697

                          set fill color to color id 11

                          set justification to fully justified

                          set kerning method to "Optisch"

                          set tracking to -125

                          set composer to "Adobe Composer alinea"

                          set name of xFrame02 to "sampleText"

                      end tell

                  end tell

              end tell

              set h1 to h1

              set g1 to g1 + 40.4

              set h2 to h2

              set g2 to g2 + 40.4

              set h3 to h3

              set g3 to g3 + 40.4

              set h4 to h4

              set g4 to g4 + 40.4

              set f to (f + 1)

          end repeat

          set j1 to 237.5

          set i1 to 5.5

          set j2 to 240.5

          set i2 to 42.9

          set j3 to 241.5

          set i3 to 5.5

          set j4 to 291.5

          set i4 to 42.9

          repeat 5 times

              tell application "Adobe InDesign CS6" -- [rij 5:]

                  tell page xPage of document 1

                      set xFrame01 to make text frame with properties {geometric bounds:{j1, i1, j2, i2}, fill color:color id 11, contents:(item f of myFontList), text frame preferences:{vertical justification:center align}}

                      delay 0.25

                      tell xFrame01 to tell paragraph 1

                          set applied font to "DINCond    Medium"

                          set point size to 5.5

                          set fill color to color id 15

                          set left indent to 1.0

                          set right indent to 0.5

                          set baseline shift to 0.5

                      end tell

                      set xFrame02 to make text frame with properties {geometric bounds:{j3, i3, j4, i4}, fill color:color id 14, contents:sampleText, text frame preferences:{vertical justification:justify align, auto sizing type:height and width proportionally, auto sizing reference point:top left point}}

                      tell xFrame02 to tell paragraph 1

                          set applied font to (item f of myFontList)

                          set point size to 27.712

                          set leading to 25.697

                          set fill color to color id 11

                          set justification to fully justified

                          set kerning method to "Optisch"

                          set tracking to -125

                          set composer to "Adobe Composer alinea"

                          set name of xFrame02 to "sampleText"

                      end tell

                  end tell

              end tell

              set j1 to j1

              set i1 to i1 + 40.4

              set j2 to j2

              set i2 to i2 + 40.4

              set j3 to j3

              set i3 to i3 + 40.4

              set j4 to j4

              set i4 to i4 + 40.4

              set f to (f + 1)

          end repeat

         

          tell application "Adobe InDesign CS6"

              tell page xPage of document 1

                  repeat with oneFrame in (get text frames)

                      set a to visible bounds of oneFrame

                      set x1 to second item of a

                      set x2 to fourth item of a

                      set b to x2 - x1

                      set c to 37.4 / b * 100

                      tell oneFrame to set horizontal scale to c

                      tell oneFrame to set vertical scale to c

                  end repeat

              end tell

          end tell

         

          set xPage to (xPage + 1)

         

          tell application "Adobe InDesign CS6"

              tell document 1

                  tell every text frame to change text

                 

                  select (every page item whose name is "sampleText")

                  tell application "System Events" to tell process "InDesign"

                      key code 31 using {shift down, command down}

                  end tell

                  try

                      select (every page item whose name is "sampleText")

                      set name of selection to "doetutniet"

                  end try

                 

                  set myMaster to object reference of master spread "A-Stramien"

                  set myNewPage to make page with properties {applied master:myMaster}

              end tell

              set active spread of active window to parent of myNewPage

              zoom layout window 1 given fit page

          end tell

      end repeat

       

      tell application "Adobe InDesign CS6"

          tell document 1

              delete myNewPage

          end tell

      end tell