• 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: Bounds of quark 6 as a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bounds of quark 6 as a string


  • Subject: Re: Bounds of quark 6 as a string
  • From: Hans Haesler <email@hidden>
  • Date: Mon, 10 Jan 2005 16:28:55 +0100

On Mon, 10 Jan 2005, Bastiaan Boertien wrote:

>I'm trying to make the bounds of a generic box into a string so i can
>store them in a file.
>
>Here's my code to know what I'm trying to do

Bastiaan,

I won't repeat your code but a simplified version of it.

But, first, some remarks:

- When setting the variable 'TheText' you don't need to specify
'as string'. The text is between quotes, so it's already a string.

- 'count the numbers of generic boxes' returns 0 (= zero),
so the script goes straight to writing the title to the file...

- But your code says 'write TheText to file theFile as text'
And this generates an error because of the 'as text'.

- When getting the bounds, the result looks like a list. But its
class is 'measurement rectangle'. You must coerce it to a list and
then each list item to a string.

---
set aString to "This list contains the bounds of every box in the document" & return & return

tell document 1 of application "QuarkXPress 6.5"
  set docName to name
  repeat with i from 1 to count of generic boxes
    tell generic box i
      set {y1, x1, y2, x2} to bounds as list
      if class is text box then
        set boxClass to "Text Box"
      else if class is picture box then
        set boxClass to "Picture Box"
      else if class is line box then
        set boxClass to "Line Box"
      else
        set boxClass to "Others"
      end if
    end tell
    set aString to aString & tab & (y1 as string) & tab & (x1 as string) & tab ¬
      & (y2 as string) & tab & (x2 as string) & tab & tab & boxClass & return
  end repeat
end tell

set boundsFile to ((path to desktop folder) as string) & docName & ".txt"

try
  open for access file boundsFile with write permission
  set eof of file boundsFile to 0
  write aString to file boundsFile
  close access file boundsFile
on error
  try
    close access file boundsFile
  end try
end try
---
I have deleted the line 'display dialog "still not working"' because
now it should work...

---
Hans Haesler <email@hidden>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Bounds of quark 6 as a string (From: Bastiaan Boertien <email@hidden>)

  • Prev by Date: Re: Hidden Folders
  • Next by Date: Re: Hidden Folders
  • Previous by thread: Bounds of quark 6 as a string
  • Next by thread: forbidden characters in applescript
  • Index(es):
    • Date
    • Thread