osdir.com
mailing list archive

Subject: Re: Quark frustration: setting rule below on paragraphs - msg#00062

List: applescript-users

Date: Prev Next Index Thread: Prev Next Index
Hi.Today i had the same problem. It seems that for a direct manipulation of paragraphs in a story a selection is needed.
The following code will work for me (10.4.11 / QXP 6.51 & 7.31 / PPC G4):

tell application "QuarkXPress Passport"
    tell document 1
        set theRef to a reference to last paragraph of story 1 of text box "name of the box"
        --set theRef to a reference to paragraph 6 of story 1 of text box "name of the box"
       select theRef
       tell theRef to set rule on of rule below to false
   end tell
end
 tell
Best regards,Christian Sonntag 
info@xxxxxxxxxxxxxxxxwww.motions-media.deforum.motions-media.de • www.qusa.de
P
 Think before you print!




  • SubjectQuark frustration: setting rule below on paragraphs
  • From: Jeff Jungblut <email@hidden>
  • Date: Thu, 27 Mar 2008 11:56:25 -0700
  • Delivered-to: email@hidden
  • Delivered-to: email@hidden
  • Thread-index: AciQPEFqf7ZEYvwvEdycTAARJH7xWA==
  • Thread-topic: Quark frustration: setting rule below on paragraphs
  • User-agent: Microsoft-Entourage/11.4.0.080122
Title: Quark frustration: setting rule below on paragraphsI’m trying to write a script that will turn on the rule below on every paragraph in a story except those paragraphs which are headings (style name is “Glance”) or which are empty spacer paragraphs (length < 3).  The following code should enable the rule below for all paragraphs, then turn it off for heading and blank paragraphs, but for some reason the code affects only selected paragraphs in the story, not the whole story. It also seems to be ignoring whether or not the whose conditions (heading or blank) are being met. So the script in effect turns on the rule below for every selected paragraph, then turns it off, leaving the document in the state it was in before the script was run. (If I comment out the last two tell blocks with the whose clauses, then the script applies rule below to every selected paragraph, not all paragraphs.)

tell application "QuarkXPress"
    tell document 1
        tell story 1 of current box
           
            tell every paragraph
               set rule on of rule below to true
               set position of rule below to "50%"
                set width of rule below to "0.4 pt"
            end tell
           
            -- turn off rule on headings styled "Glance"
           tell (every paragraph whose style sheet is "Glance")
                set rule on of rule below to false
           end tell
           
            -- turn off rule on blank paras
           tell (every paragraph whose length is less than 3)
                set rule on of rule below to false
           end tell
           
        end tell
   end tell
end
 tell

So my question is, am I doing something wrong here?? Why is Quark ignoring the whose clause?  (I haven’t had that problem before.)
Why does it affect only selected paragraphs??

I tried running it in a repeat loop, doing one paragraph at a time, but it still had the same effect of turning on the rule below for every paragraph in the story ... Each time through the loop ... 135 times for every paragraph in the story.

Help!! What am I missing??


-- 
Jeff Jungblut
email@hidden
Senior Graphic Designer & Web Developer
Uptown Publications



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

This email sent to maillists@xxxxxxxxx
Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: On My Mac

Below is the script for my latest On_My_Mac handler. I've removed the repeat loop since it is not necessary for testing On My Mac. (I used it to get the path to the folder containing the message files.) It works correctly with all the mailboxes I have in Mail. But ... do you have mailboxes that will make it fail? tell application "Mail" activate try set frontViewer to (message viewer 1) on error return end try set selMailbox to selected mailboxes of frontViewer if (count items of selMailbox) â 1 then return set selMailbox to (item 1 of selMailbox) -- if not my On_My_Mac(selMailbox) then beep else display dialog "\"On My Mac\"!" end if end tell ------------------ on On_My_Mac(mbox) -- mbox is a Mail mailbox. tell application "Mail" try set mboxName to (name of mbox) as text unread count of mbox on error return false -- RSS or Notes end try -- if mbox is trash mailbox then return false if mbox is inbox then return false if mbox is sent mailbox then return false if mbox is drafts mailbox then return false if mbox is junk mailbox then return false if mbox is outbox then return false -- if first character of mboxName is in {"I", "D", "J", "N", "O", "S", "T"} then if mboxName is "INBOX" then return false if mboxName starts with "Deleted Messages" then return false if mboxName starts with "Drafts" then return false if mboxName starts with "Junk" then return false if mboxName starts with "Notes" then return false if mboxName starts with "Outbox" then return false if mboxName starts with "Sent Messages" then return false if mboxName starts with "ToDos" then return false end if -- try set acnt to (account of mbox) name of acnt account type of acnt return false -- mailboxes On My Mac have no account end try end tell return true end On_My_Mac _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (applescript-users@xxxxxxxxxxxxxxx) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/maillists%40codeha.us Archives: http://lists.apple.com/archives/applescript-users This email sent to maillists@xxxxxxxxx

Next Message by Date: click to view message preview

Re: Same code gives different answers in 2 different scripts

At 22:23 -0700 6/1/09, Christopher Nebel wrote: >Long answer: <http://docs.sun.com/source/806-3568/ncg_goldberg.html>. > >Short answer: Floating-point math such as AppleScript uses is not exact. >What Script Editor displays as the result is often not the precise value of >the number, and operations such as "div 1" can reveal the tiny discrepancies. > AppleScript is not unique in this; most programming languages use the same >floating-point standard. The long answer is a real treatise. Accurate but perhaps overdone. Let me suggest an intermediate: IEEE 64-bit floating point splits the 64 bits into three parts, one bit for the sign, 11 bits for the characteristic, and 52 bits for the "mantissa" which is a common, but incorrect, use of the term. The mantissa is always treated as a binary fraction between 1/2 and 1. The characteristic is the power of two, positive or negative by which the mantissa is to be multiplied. Because the first bit of a number between 1/2 and 1 is always one it is actually not kept in the 52 bits. Take a minute to think about those mantissas. in binary .1 means 1/2, .01 means 1/4, .001 means 1/8 and so on. It's a whole lot like those inch marks that still appear, in the US of A anyway, on tape measures and school rulers. It'a also a whole lot like dividing gallons into quarts, pints, cups and on down to teaspoons. In the world of decimal arithmetic if you try to express 1/3 exactly you start the division process and the first step shows 0.3 with a remainder of 0.1. the second step shows 0.33 with a remainder of .01 and it goes on forever yielding the repeated decimal .333333333 which goes on forever. As soon as you limit the number of digits you introduce the kind of rounding error that's being discussed. Computers will never understand the .3333... symbolism that says "repeat forever"; well, the likes of Maple and Mathematica do make a pretty good effort. In binary arithmetic there is a similar problem that shows up most often in exact decimal fractions involving odd digits. 0.1 (base 10) is an example. It comes out as 1/16 + 1/32 + 1/256 or the mantissa 0.00011001100110011... which repeats forever but has to be cut off at 52 bits. Sure it's an error but if you want to use a binary computer for decimal fractions you just have to live with it. 64 bit floating point accuracy will always be limited to about 15 decimal digits. For nice numbers like 0.125 you'll get exact results but for 0.1 and 0.7 it just isn't possible. One thought: Always do your rounding or formatting at the very end of all calculations. Another: If you can come up with arithmetic that can be done in integers you'll have fewer worries. Doing financial calculations in pennies instead of dollars with fractional parts is fairly simple as long as you stay away from compound interest. And a third. Think about how much better off we would be if those Persians who invented decimal numbers had ignored their thumbs. A base-8 numeric system would be much easier to work with. Metric standards are not really much better than imperial when it comes to how people like to divide things into halves, quarters and the like. And we could all go back to the IBM 1620 which did its arithmetic in decimal but somehow I doubt that we'd be happy with the speed of execution. -- --> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <-- _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (applescript-users@xxxxxxxxxxxxxxx) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/maillists%40codeha.us Archives: http://lists.apple.com/archives/applescript-users This email sent to maillists@xxxxxxxxx

Previous Message by Thread: click to view message preview

Re: On My Mac- FTP checking

Here's an idea- broad view. A stay-open script runs and polls the contents of the ftp site and builds a report of filenames with timestamps, or filenames and file sizes. Then after a set number of minutes, the script makes second pass and creates a second report. The two are compared and the files that haven't been modified are added to a list and acted upon. After that you either remove the processed files from the report, or start a new empty report. For generating the report, I use ncftp on the command line, a very powerful and handy FTP utility. It is the engine that Transmit runs on. ncftp contains some other utilities, one of which is ncftpls which is designed to run in scripts. Ncftpls is how I get FTP directory reports for mod dates and size. http://www.ncftp.com/ncftp/ http://www.ncftp.com/ncftp/doc/ncftpls.html - Eric _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (applescript-users@xxxxxxxxxxxxxxx) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/maillists%40codeha.us Archives: http://lists.apple.com/archives/applescript-users This email sent to maillists@xxxxxxxxx

Next Message by Thread: click to view message preview

Word Line Numbers

I have a word document Formatted with line numbers in page view. Does any body know how to get the line number associated with the current selection of text in applescript? _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (applescript-users@xxxxxxxxxxxxxxx) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/maillists%40codeha.us Archives: http://lists.apple.com/archives/applescript-users This email sent to maillists@xxxxxxxxx
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by