• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quirks of Annotate script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quirks of Annotate script


  • Subject: Re: Quirks of Annotate script
  • From: Hans Haesler <email@hidden>
  • Date: Fri, 29 Dec 2006 10:09:43 +0100

On Thu, 28 Dec 2006, Ripka, Herb wrote:

>The script works great, but it has four Really Annoying Quirks
>(I have no idea why these happen):

Herbert,

I can confirm point 3, only. The boxes with "0 0" are created
because the test 'count of images in picture box i' always returns 1,
even when the picture box is empty.

Here is a modified version with some improvements(?)
- existing "annotate" boxes are deleted
- the measurement units are stored and reset at the end
- an eventual selection is set to null (faster)
- the view scale is set to fit the page to the window
- the current page is shown
- empty picture boxes and pasted picts are excluded
- no need for all of them 'of it'
- getting the name of the image file is simplified
- no need for naming the picture boxes
- a dialog says "Done." when the script has finished
---
tell application "QuarkXPress 6.5"
 activate
 if (document 1 exists) then
  tell document 1
   try
    delete (every text box whose name contains "annotate")
   end try
   set {hm, vm} to {horizontal measure, vertical measure}
   if hm is not points or vm is not points then
    set properties to {horizontal measure:points, vertical measure:points}
   end if
   set selection to null
   set view scale to fit page in window
   set AppleScript's text item delimiters to ":"
   repeat with p from 1 to count of pages
    show page p
    tell page p
     repeat with i from 1 to count of picture boxes
      set filePath to (file path of image 1 of picture box i) as Unicode text
      if filePath is not "null" and filePath is not "no disk file" then
       set filename to text item -1 of filePath
       tell picture box i
        set {sc1, sc2} to scale of image 1 as list
        set {y1, x1} to origin of bounds as list
       end tell
       set y2 to ((y1 as real) + 14)
       set x2 to ((x1 as real) + 175)
       make text box at beginning with properties {bounds:{y1, x1, y2, x2} ¬
        , color:"yellow", name:"annotate" & i, runaround:none runaround}
       tell story 1 of text box ("annotate" & i)
        set properties to {font:"Times", size:12}
        set contents to ("" & filename & "  " & (sc1 as text))
       end tell
      end if
     end repeat
    end tell
   end repeat
   set AppleScript's text item delimiters to {""}
   if hm is not points or vm is not points then
    set properties to {horizontal measure:hm, vertical measure:vm}
   end if
  end tell
  display dialog "Done." buttons "OK" default button 1 with icon 1 giving up after 1
 else
  display dialog "Open a document, please." buttons "OK" default button 1 with icon 2
 end if
end tell
---
Regards,
Hans





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Quirks of Annotate script (From: "Ripka, Herb" <email@hidden>)

  • Prev by Date: Re: file systems burned by drutil
  • Next by Date: Re: AppleScript-Users Digest, Vol 3, Issue 652
  • Previous by thread: Quirks of Annotate script
  • Next by thread: Re: Quirks of Annotate script
  • Index(es):
    • Date
    • Thread