RE: Quark Scripting
RE: Quark Scripting
- Subject: RE: Quark Scripting
- From: "Sprague, Graham" <email@hidden>
- Date: Fri, 1 Dec 2000 13:49:03 -0500
Is it possible to get the name of an item using the "uniqueID" property of a
generic box in QuarkXpress. Note I have set the names of the selected boxes
with another script before I ran this one. Each time I get an error that
says can access the name of "202"(the uniqueID for the item) Can any one
Help!! I am using the following code...
---------------------
tell application "QuarkXPress(tm) 4.11"
tell document 1
tell page 1
set theList to uniqueID of every generic box whose selected
is true
set the theCount to the number of items in theList
display dialog "Enter Group Number:" default answer ""
buttons ,
{"Cancel", "OK"}
copy the result as list to {groupNum}
set i to 0
repeat while i is less than theCount
set i to i + 1
set curID to item i of theList as integer
set curName to the name of generic box whose
uniqueID is curID
set lastChar to the last character of curName
--display dialog curName
tell document 1
tell page 1
if curName contains "Copy" then
set name of text box curName
whose selected is true to ("Copy Box " & groupNum)
else
set name of picture box
curName whose selected is true to ("Image Box " & groupNum & lastChar)
end if
end tell
end tell
end repeat
end tell
end tell
end tell
-------------------------
Thanks,
Graham Sprague
Advertising Systems Administrator
Staples, Inc.
508-253-8170
>
----------
>
From: email@hidden
>
Reply To: email@hidden
>
Sent: Friday, December 1, 2000 1:09 AM
>
To: email@hidden
>
Subject: applescript-users digest, Vol 2 #89 - 12 msgs
>
>
Send applescript-users mailing list submissions to
>
email@hidden
>
>
To subscribe or unsubscribe via the World Wide Web, visit
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
or, via email, send a message with subject or body 'help' to
>
email@hidden
>
>
You can reach the person managing the list at
>
email@hidden
>
>
When replying, please edit your Subject line so it is more specific
>
than "Re: Contents of applescript-users digest..."
>
>
>
Today's Topics:
>
>
1. ReadOnly problem (Bill Metzinger)
>
2. Re: ReadOnly problem (paul skinner)
>
3. Re: ReadOnly problem (Jolly Roger)
>
4. Re: Quitting an applet? (Rob Jorgensen)
>
5. Re: Month as Integer (Richard 23)
>
6. Re: Coerce small icon into picture (getting the icon) (Richard 23)
>
7. Re: Coerce small icon into picture (getting the icon) (Johan Solve)
>
8. Re: Best way to wait (Marc K. Myers)
>
9. Scripting annotations in Acrobat (John Hanly)
>
10. Re: Month as Integer (Nigel Garvey)
>
11. Re: Month as Integer (Sun Real)
>
12. Scripter - Slow as a Snail. . . (Jason Bourque)
>
>
--__--__--
>
>
Message: 1
>
Date: Thu, 30 Nov 2000 10:33:54 -0800 (PST)
>
From: Bill Metzinger <email@hidden>
>
Reply-To: <email@hidden>
>
To: email@hidden
>
Subject: ReadOnly problem
>
>
Well,
>
I just did a good one. I saved a script as read only replacing my original
>
which I must now edit. I seemed to have locked myself outside and was
>
hoping
>
I could learn how to pick the lock.
>
>
Bill
>
TC Advertising
>
"Every time that wheel goes round, you're bound to cover just a little
>
more
>
ground."
>
>
>
>
>
>
_______________________________________________________
>
Tired of slow Internet? Get @Home Broadband Internet
>
http://www.home.com/xinbox/signup.html
>
>
--__--__--
>
>
Message: 2
>
Date: Thu, 30 Nov 2000 14:03:48 -0500
>
Subject: Re: ReadOnly problem
>
From: paul skinner <email@hidden>
>
To: <email@hidden>
>
>
I hope you have a previous version somewhere. I don't think that lock can
>
be
>
picked.
>
--
>
Paul Skinner
>
>
...little bit farther, just a little bit more, little bit harder than
>
you've
>
tried before. 8^ )
>
>
> Well,
>
> I just did a good one. I saved a script as read only replacing my
>
original
>
> which I must now edit. I seemed to have locked myself outside and was
>
hoping
>
> I could learn how to pick the lock.
>
>
>
> Bill
>
> TC Advertising
>
>
> "Every time that wheel goes round, you're bound to cover just a little
>
more
>
> ground."
>
>
--__--__--
>
>
Message: 3
>
Date: Thu, 30 Nov 2000 13:53:37 -0600
>
Subject: Re: ReadOnly problem
>
From: Jolly Roger <email@hidden>
>
To: Applescript-Users <email@hidden>
>
>
on 11/30/2000 12:33 PM, Bill Metzinger wrote:
>
>
> I just did a good one. I saved a script as read only replacing my
>
original
>
> which I must now edit. I seemed to have locked myself outside and was
>
hoping
>
> I could learn how to pick the lock.
>
>
I hope you have a backup handy. There's no way to recover your script
>
once
>
you've made that mistake. After one or two times, most people learn their
>
lesson. I'm thankful that the creators of Smile saw to it to append the
>
word "copy" to the end of a script when you Save As...it's saved my butt
>
many times over. :)
>
>
JR
>
>
--__--__--
>
>
Message: 4
>
Date: Thu, 30 Nov 2000 15:17:17 -0500
>
To: email@hidden
>
From: Rob Jorgensen <email@hidden>
>
Subject: Re: Quitting an applet?
>
>
On 11/30/2000, Geoff Graham commented on "Re: Quitting an applet?":
>
>
>At 10:09 PM -0800 11/29/00, Rob Jorgensen <email@hidden> wrote:
>
>
<snip>
>
>
> >This script will stuff the first item in fileList and then just quit
>
>>doing anything, with StuffIt Deluxe remaining the frontmost
>
>>application. If I activate the script again via the Application Menu,
>
>>it finishes executing as written and quits. The weird thing is that
>
>>when it is activated this way, StuffIt Deluxe does not come to the
>
>>front again, even though it is still finishing its tasks.
>
>>
>
>>Any ideas why the script is losing control of things? Any ideas on
>
>>how to fix it?
>
>
>
>fileList is a list, so you want to use *item* i and not alias i.
>
>Also the "into archive item "Screenshots" just doesn't sound right,
>
>but I don't have SD. try dropping the item in that one eg:
>
>
>
>stuff item i of fileList into archive "Screenshots"...
>
>
>
>or use Stuffit Commands scripting addition to do it and not Deluxe.
>
>
I finally used the StuffIt Commands and it is a much better approach,
>
with much less code and overhead involved.
>
>
Thanks to everyone who responded. :-)
>
>
Later,
>
>
Rob Jorgensen
>
Ohio, USA
>
>
--__--__--
>
>
Message: 5
>
Subject: Re: Month as Integer
>
Date: Thu, 30 Nov 2000 12:38:27 -0800
>
From: Richard 23 <email@hidden>
>
To: <email@hidden>
>
>
>I know it doesn't work as it stands but maybe it's just a matter of
>
>coding it right.
>
>'return November of themonthlist' works fine, so the question really
>
>is how you specify a named record by a variable? (wasn't this
>
>discussed recently? I think it was about using variable variable
>
>names but that should be related)
>
>
I really don't think so. I've tried this sort of thing before and
>
it always resolves to a similar checkmate.
>
>
You can redefine the constants no problem:
>
>
I do the same sort of thing to provide my scripts with name and
>
version properties which can be useful when the script has been
>
brought into another script with "load script". It makes its
>
easy to uniquely identify what would otherwise be anonymous.
>
>
Back to the month problem:
>
>
property March: 3
>
>
to get the value rather than the constant you use my:
>
>
return {March, my March}
>
>
--> {March, 3}
>
>
by this time you think you're almost there but then it hits you.
>
>
How can you get the constant value "March" being held in a variable
>
to reference the script's (or current application's) March property?
>
>
Well, you don't. Your variable would be be holding a value of type
>
"class", while your script contains a user defined property holding
>
a value of the integer class. The two values cannot exist in the same
>
container at the same time therefore they are entirely different items.
>
>
The fact that they share the same label makes no difference. They may
>
as well be in different scripts because you'll never get them to mesh.
>
>
If someone can prove me wrong I'd appreciate it.
>
Good idea, but no cigar.
>
>
Here's one of the methods I've used but it's still a bit wordy:
>
>
property Month_String : "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
>
>
count words of (text 1 thru (offset of (text 1 thru 3 of ==>
>
(theDate's month as string)) in Month_String) of Month_String)
>
>
I'd like this numerical coercion and a boolean to integer coercion.
>
A lot of times getting false as 0 or true as 1 would be convenient but
>
is currently not possible without and if-then-else construct.
>
>
>
R23
>
>
--__--__--
>
>
Message: 6
>
Subject: Re: Coerce small icon into picture (getting the icon)
>
Date: Thu, 30 Nov 2000 13:07:13 -0800
>
From: Richard 23 <email@hidden>
>
To: <email@hidden>
>
>
>I'm trying to return a small icon of a file for a directory lister
>
>cgi, and use Akua Sweets to coerce the icon into a picture that
>
>Clip2gif later can convert to a gif. However, I can't manage to
>
>specify that I want to get the small 8-bit icon, I can only get the
>
>default 32x32 icon.
>
>
>
>
>
>set iconsuite to (the icon for file filename)
>
>set the clipboard to iconsuite as picture -- returns 32x32 icon
>
>
>
>
>
>set iconsuite to (the icon for file filename) as small eight bit icon
>
>-- selects last words and gives error "Can't make xxxx into the expected
>
>type"
>
>set the clipboard to iconsuite as picture
>
>
I can answer the Finder part. Take another look at the definition
>
of icon family in the Finder's dictionary. You'll find contains icon
>
data for each of the 10 icon resource types. So you don't need to
>
coerce it, you need to get the property of it:
>
>
tell application "Finder"
>
get icon of item 1
>
set theIcon to result's small 8 bit icon
>
end tell
>
>
R23
>
>
--__--__--
>
>
Message: 7
>
Date: Thu, 30 Nov 2000 23:08:22 +0100
>
To: email@hidden
>
From: Johan Solve <email@hidden>
>
Subject: Re: Coerce small icon into picture (getting the icon)
>
>
> >set iconsuite to (the icon for file filename) as small eight bit icon
>
>>-- selects last words and gives error "Can't make xxxx into the expected
>
>>type"
>
>>set the clipboard to iconsuite as picture
>
>
>
>I can answer the Finder part. Take another look at the definition
>
>of icon family in the Finder's dictionary. You'll find contains icon
>
>data for each of the 10 icon resource types. So you don't need to
>
>coerce it, you need to get the property of it:
>
>
>
>tell application "Finder"
>
> get icon of item 1
>
> set theIcon to result's small 8 bit icon
>
>end tell
>
>
>
>R23
>
>
OK, so I have a small eight bit icon. But I can't coerce that into a
>
picture that I can send to clip2gif.
>
>
So:
>
I can get a large 8-bit icon and coerce it to a picture using Akua
>
Sweets
>
or
>
I can get the small 8-bit icon using Finder
>
but not both...
>
>
--
>
Johan Svlve
>
Web Application/FileMaker Developer
>
MONTANIA SOFTWARE & SOLUTIONS [FSA Member]
>
http://www.montania.se mailto:email@hidden
>
Halmstad Branch: Brogatan 16, SE-30243 Halmstad
>
phone +46 35-127205 fax +46 35-2802654 mobile +46 709-515570
>
Ronneby HQ: Soft Center , SE-37225 Ronneby
>
phone +46 457-386200 fax +46 457-26479
>
>
--__--__--
>
>
Message: 8
>
Date: Thu, 30 Nov 2000 17:41:24 -0500
>
From: "Marc K. Myers" <email@hidden>
>
Reply-To: email@hidden
>
Organization: [very little]
>
To: email@hidden
>
Subject: Re: Best way to wait
>
>
Pier Kuipers wrote:
>
> Date: Thu, 30 Nov 2000 12:19:38 +0000
>
> To: Applescript Mailing List <email@hidden>
>
> From: Pier Kuipers <email@hidden>
>
> Subject: Re: Best way to wait
>
>
>
> How about this one:
>
>
>
> display dialog "Hello!"
>
> set x to ((current date) + 25)
>
> repeat
>
> if (current date) > x then exit repeat
>
> end repeat
>
> activate me
>
> beep 3
>
> display dialog "Hello Again!"
>
>
>
> Save as application, launch, and see what happens: the script keeps
>
> running for 25 seconds, during which time you could be doing other
>
> things.
>
>
>
> Pier.
>
>
That's actually about the worst way to wait! It ties up your computer by
>
constantly retrieving the current date and doing comparisons. Makes it
>
difficult for any other application to get any cycles. The AppleScript
>
Sourcebook has a whole section on this at
>
<http://www.AppleScriptSourcebook.com/tips/idlethoughts.html>. A much
>
more efficient way would be to use an idle handler like this:
>
>
global firstTime
>
>
on run
>
set firstTime to true
>
end run
>
>
on idle
>
if firstTime
>
set firstTime to false
>
return 25
>
end if
>
[do the stuff you want to do after 25 seconds]
>
end idle
>
>
If you wanted to check for some event every 25 seconds and do something
>
when it occurs and then quit, the idle handler would look like this:
>
>
on idle
>
if myEvent then
>
[do the stuff you want to do if the event has happened]
>
quit
>
end if
>
return 25
>
end idle
>
>
Marc [11/30/00 4:41:44 PM]
>
>
--__--__--
>
>
Message: 9
>
Date: Thu, 30 Nov 2000 18:31:13 -0500
>
Subject: Scripting annotations in Acrobat
>
From: John Hanly <email@hidden>
>
To: <email@hidden>
>
>
What I'd like to do is add some text annotations to a lot of .pdf files.
>
We
>
are taking files from different sources and make them all into .pdf. We
>
then want to put some identification information on the .pdf's. Up to now
>
they have been using the Text annotation tool by hand to do this. I
>
figured
>
I'd give applescripting this a try.
>
>
The problem I've found is I don't have any example scripts on how to do
>
this
>
and searching the web and some of the applescript websites and the mac
>
script archive hasn't yielded any either.
>
>
When I try the following
>
>
tell application "Acrobat 4.0"
>
make new PDTextAnnot
>
end tell
>
>
It actually gives me a note annotation not a text annotation. I've tried
>
changing the properties but it ignores any settings I give which I presume
>
is because I do not have the basic syntax correct.
>
>
This is a very simple (I think). All I want to do is add a line at the top
>
and bottom of each page. Can anyone give me some pointers or better yet
>
some
>
example scripts.
>
>
thanks
>
--
>
John Hanly MIS Manager
>
American Corporate Counsel Association
>
http://www.acca.com
>
mailto:email@hidden
>
(W) (202) 293-4103
>
>
--__--__--
>
>
Message: 10
>
Subject: Re: Month as Integer
>
Date: Fri, 1 Dec 2000 00:11:49 +0000
>
From: Nigel Garvey <email@hidden>
>
To: "AppleScript Users" <email@hidden>
>
>
Johan Solve wrote on Thu, 30 Nov 2000 09:19:39 +0100:
>
>
>Would it be possible to do something like this:
>
>
>
>on GetMonthNumber()
>
> set theMonth to month of (current date)
>
> set theMonthList to {January:1, February:2, March:3, April:4, May:5,
>
-+
>
> June:6, July:7, August:8, September:9, October:10, -+
>
> November:11, December:12}
>
> return themonth of themonthlist
>
>end GetMonthNumber
>
>
>
>I know it doesn't work as it stands but maybe it's just a matter of
>
>coding it right.
>
>'return November of themonthlist' works fine, so the question really
>
>is how you specify a named record by a variable? (wasn't this
>
>discussed recently? I think it was about using variable variable
>
>names but that should be related)
>
>
[Quotes from Pier Kuipers and Michelle Steiner]
>
>
That would be a very smart and fast method if it worked, though I'm
>
afraid I haven't been able to make it do so yet. The fastest and simplest
>
way of getting the month number that I know is that attributed to
>
Emmanuel Livy, which would look like this in the given handler:
>
>
on GetMonthNumber()
>
set theDate to (current date)
>
copy theDate to b
>
set the month of b to January
>
return 1 + (theDate - b + 1314864) div 2629728
>
end GetMonthNumber
>
>
NG
>
>
--__--__--
>
>
Message: 11
>
Subject: Re: Month as Integer
>
Date: Fri, 1 Dec 2000 13:32:25 +1100
>
From: Sun Real <email@hidden>
>
To: "AS Users List" <email@hidden>
>
>
From Johan Solve <email@hidden>, Thursday, 30 November 2000:
>
>Would it be possible to do something like this:
>
>
>
>on GetMonthNumber()
>
> set theMonth to month of (current date)
>
> set theMonthList to {January:1, February:2, March:3, April:4, May:5,
>
-+
>
> June:6, July:7, August:8, September:9, October:10, -+
>
> November:11, December:12}
>
> return themonth of themonthlist
>
>end GetMonthNumber
>
>
>
>I know it doesn't work as it stands but maybe it's just a matter of
>
>coding it right.
>
>'return November of themonthlist' works fine, so the question really
>
>is how you specify a named record by a variable?
>
>
The months names are constants, not variables. I haven't played with
>
this but I (a) don't think it could be made to work and (b) wouldn't
>
recommend trying to use constants as record labels in any case. The
>
fastest of these methods was posted by Michelle Steiner yesterday.
>
>
Whilst it makes very little difference unless you are doing it a
>
squillion or so times, I use this, much faster, method:
>
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
-- -- -- -- -- -- -- -- -- -- -- -- --
>
-- -- monthNumber -- -- -- -- from Emmanuel Levy --
>
returns an integer
>
-- corresponding to the current month; called by the date handlers
>
on monthNumber(theDate) -- pass a date object
>
copy theDate to dateTemp
>
set month of dateTemp to January
>
return (1 + (theDate - dateTemp + 1314864) div 2629728)
>
end monthNumber
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
-- -- -- -- -- -- -- -- -- -- --
>
>
Cheers,
>
>
Richard Morton
>
>
-- Great Lies of the Music Business: "The place was packed"
>
>
--__--__--
>
>
Message: 12
>
Date: Thu, 30 Nov 2000 22:21:17 -0500
>
Subject: Scripter - Slow as a Snail. . .
>
From: Jason Bourque <email@hidden>
>
To: AppleScript Mailing Lists <email@hidden>
>
>
Hello Everyone,
>
>
>
I have been using Scirpter 2.5 and love it. But I just installed a new
>
copy
>
on a G4 for a fellow co-worker and it is so slow.
>
>
The G4 of course has 9.0.4 and all publishing apps etc.
>
>
>
But it is especially slow when typing, selecting text, copying, pasting,
>
and
>
even compiling?
>
>
>
Has anyone had any experience with this.
>
>
My next step is do a conflict test with the extensions and trouble shoot
>
from there.
>
>
Thanks,
>
>
>
Jason Bourque
>
>
>
--__--__--
>
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
>
>
End of applescript-users Digest