Re: applescript-users digest, Vol 2 #1021 - 16 msgs
Re: applescript-users digest, Vol 2 #1021 - 16 msgs
- Subject: Re: applescript-users digest, Vol 2 #1021 - 16 msgs
- From: "Marc K. Myers" <email@hidden>
- Date: Fri, 31 Aug 2001 19:52:22 -0400
- Organization: [very little]
email@hidden wrote:
>
>
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. Re: Getting running status of an application (Mr Tea)
>
2. Mr Garvey's whimsical 'don't tell...' block (Mr Tea)
>
3. Tex-Edit, colorize HTML text? (Rachel)
>
4. Re: Applescript & Tex-Edit errors (Rachel)
>
5. Re: Skip a step in a repeat loop (Arthur J Knapp)
>
6. Re: applescript-users digest, Vol 2 #1019 - 12 msgs (John W Baxter)
>
7. Re: Skip a step in a repeat loop (Paul Berkowitz)
>
8. Re: KinderShell (Jon Pugh)
>
9. Re: applescript-users digest, Vol 2 #1019 - 12 msgs (John W Baxter)
>
10. Re: processing time & stack overflow!!! (Arthur J Knapp)
>
11. Re: Tex-Edit, colorize HTML text? (Timothy Bates)
>
12. Re: processing time & stack overflow!!! (Jon Pugh)
>
13. Re: processing time & stack overflow!!! (Victor Yee)
>
14. Playing with Objects: LinkObjects1.0a (Victor Yee)
>
15. Bug using Applescript applet as helper app? (Neil Appel)
>
16. RE: processing time & stack overflow!!! (Stockly, Ed)
>
>
--__--__--
>
>
Message: 1
>
Date: Fri, 31 Aug 2001 14:57:57 +0100
>
Subject: Re: Getting running status of an application
>
From: Mr Tea <email@hidden>
>
To: AS List <email@hidden>
>
>
This from Bob.Kalbaugh - dateline 31/8/01 6.20 am:
>
>
> tell application "Finder"
>
> if process "Tex-Edit Plus" exists then
>
> quit "Tex-Edit Plus"
>
> end if
>
> end tell
>
>
I think you need to replace the line 'quit "Tex-Edit Plus"' with 'tell
>
application "Tex-Edit Plus" to quit'.
>
>
That should fix it.
>
>
Mr Tea
>
--
>
Brew of the day: ibid
>
>
--__--__--
>
>
Message: 2
>
Date: Fri, 31 Aug 2001 14:58:13 +0100
>
Subject: Mr Garvey's whimsical 'don't tell...' block
>
From: Mr Tea <email@hidden>
>
To: AS List <email@hidden>
>
>
This from Nigel Garvey - dateline 30/8/01 8.17 pm:
>
>
> -- don't tell application "Finder"
>
> set error_log to (path to desktop as text) & (get {day, time} of
>
> (current date))
>
> -- end don't tell
>
>
Ah. For a brief, giddy moment there I thought that this was an example of
>
'real' AppleScript language...
>
>
But wait! Surely this would be a fabulously useful feature. Do the
>
AppleScript engineers have any plans to incorporate it in future releases?
>
>
Mr Tea
>
--
>
Brew of the day: Royal Blend
>
>
--__--__--
>
>
Message: 3
>
Date: Fri, 31 Aug 2001 08:04:34 -0600
>
Subject: Tex-Edit, colorize HTML text?
>
From: Rachel <email@hidden>
>
To: AppleScript List <email@hidden>
>
>
It seems like I have wasted 2 days trying to figure this out.
>
I want to change every occurrence of a certain font in an HTML text to a
>
color. The text is also enclosed in single quotes. There must be an easy way
>
to do this.
>
In fact, I wish I had a very flexible way to format HTML text.
>
>
A more general problem is that I have the Tex-Edit dictionary but don't
>
understand how it applies to the programming. Are there instructions to help
>
me understand it?
>
>
--__--__--
>
>
Message: 4
>
Date: Fri, 31 Aug 2001 08:04:34 -0600
>
Subject: Re: Applescript & Tex-Edit errors
>
From: Rachel <email@hidden>
>
To: AppleScript List <email@hidden>
>
>
Michelle:
>
Thank you for the tip on the latest version, the original script you gave me
>
works like it should.
>
Except one thing:
>
set currFolder to folder "foldername" does not run, I had to remove the word
>
"folder".
>
>
Rachel
>
>
Entity Michelle Steiner spoke thus:
>
>
>Try upgrading to 1.6; I think that's the version that fixed the "with
>
>delimiters" bug. It's a free upgrade, and you should be able to get it
>
>using the Software update control panel--and if not that way, then from
>
>Apple's web site.
>
>
>--Michelle
>
>
--__--__--
>
>
Message: 5
>
Date: Fri, 31 Aug 2001 11:07:44 -0400
>
Subject: Re: Skip a step in a repeat loop
>
From: Arthur J Knapp <email@hidden>
>
To: <email@hidden>
>
>
>Subject: Re: Skip a step in a repeat loop
>
>Date: Thu, 30 Aug 2001 22:40:30 +0100
>
>From: Nigel Garvey <email@hidden>
>
>
>>> From: Paul Berkowitz <email@hidden>
>
>
>>> Somebody here (I forget whom - perhaps Nigel will remember) [posted a
>
>>really
>
>>> brilliant workaround - nay, solution - to this problem. I use it all the
>
>
>>> repeat with i from 1 to 100 -- or whatever, any sort of repeat loop
>
>>> repeat 1 times
>
>>> if something "what you want" then
>
>>> exit repeat --goes on to next iteratio
>
>>> end if
>
>>> --lots of blah blah
>
>>> --tons of scripting
>
>
>Arthur J Knapp wrote on Thu, 30 Aug 2001 13:37:19 -0400:
>
>
>> I actually think that this may have been me, though I'm not sure.
>
>
>I thought it was Arthur too, but I wasn't sure either. It's the sort of
>
>thing he would have invented if he'd thought of it first. ;-) So I've
>
>just done a text search through my personal archive and the earliest
>
>mention I have of it is by.... Ray Robertson, who presented the idea to
>
>this list for comment on 27th June 2000.
>
>
I just did my own search, and the really funny thing is that this
>
isn't the first time that I tried to take credit for this exact same
>
method:
>
>
>> Date: Tue, 23 Jan 2001 08:59:46 -0800
>
>> Subject: Re: "Next" in Repeat?
>
>> From: Paul Berkowitz <email@hidden>
>
>
>> Somebody. I'm afraid I forget who, once posted an ingenious solution
>
>> here to
>
>> meet the lack of a "next repeat" function in AppleScript.
>
>
>
>> repeat with i from 1 to num -- whatever the number of items is
>
>> set x to item i of yourList
>
>> repeat 1 times
>
>
>> all the time. I wish I could remember who suggested it - it was a
>
>> lurker, not a regular contributor. Perhaps Nigel Garvey remembers
>
>> - he was similarly impressed.
>
>
Arthur Knapp:
>
>
> Oh, I'll take credit, I don't mind... (though I wouldn't describe
>
> myself as a "lurker"). ;-)
>
>
I love ya, Ray Robertson... ;-)
>
>
Arthur J. Knapp
>
http://www.stellarvisions.com
>
mailto:email@hidden
>
>
Hey, check out:
>
http://www.natural-innovations.com/as/
>
>
--__--__--
>
>
Message: 6
>
Date: Fri, 31 Aug 2001 08:24:01 -0700
>
To: Applescript List <email@hidden>
>
From: John W Baxter <email@hidden>
>
Subject: Re: applescript-users digest, Vol 2 #1019 - 12 msgs
>
>
At 16:28 +1000 8/31/2001, Phillip Hall wrote:
>
>How do I get a list of running processes on Mac OS X?
>
>
One approach would be to export the information produced by the Process
>
Viewer. (Which, unfortunately is not scriptable, so the approach fails.)
>
>
Then use something like the Late Night Software XML scripting addition to
>
obtain records, then...
>
>
But I don't know what to do about the applications of interest, which may
>
hide behind the name LauchCFMApp (of which I have four at the moment).
>
>
Next month, we should find out whether Mac OS X 10.1 improves Finder in
>
this respect. We can hope.
>
>
<?xml version="1.0" encoding="UTF-8"?>
>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
>
<plist version="0.9">
>
<array>
>
<dict>
>
<key>%CPU</key>
>
<string>1.2</string>
>
<key>%MEM</key>
>
<string>2.5</string>
>
<key>NAME</key>
>
<string>.OmniWeb</string>
>
<key>PGID</key>
>
<integer>57</integer>
>
<key>PID</key>
>
<integer>324</integer>
>
<key>PPID</key>
>
<integer>57</integer>
>
<key>RSIZE</key>
>
<string>23120</string>
>
<key>STAT</key>
>
<string>Running</string>
>
<key>TIME</key>
>
<string>4:08.59</string>
>
<key>TTY</key>
>
<string>??</string>
>
<key>USER</key>
>
<string>john</string>
>
<key>VSIZE</key>
>
<string>115368</string>
>
</dict>
>
<dict>
>
<key>%CPU</key>
>
<string>3.1</string>
>
<key>%MEM</key>
>
<string>2.2</string>
>
<key>NAME</key>
>
<string>Window Manager</string>
>
<key>PGID</key>
>
<integer>57</integer>
>
<key>PID</key>
>
<integer>57</integer>
>
<key>PPID</key>
>
<integer>1</integer>
>
<key>RSIZE</key>
>
<string>19824</string>
>
<key>STAT</key>
>
<string>Running</string>
>
<key>TIME</key>
>
<string>3:25.75</string>
>
<key>TTY</key>
>
<string>??</string>
>
<key>USER</key>
>
<string>john</string>
>
<key>VSIZE</key>
>
<string>60984</string>
>
</dict>
>
(omitting the other 40)
>
--
>
John Baxter email@hidden Port Ludlow, WA, USA
>
>
--__--__--
>
>
Message: 7
>
Date: Fri, 31 Aug 2001 08:21:30 -0700
>
Subject: Re: Skip a step in a repeat loop
>
From: Paul Berkowitz <email@hidden>
>
To: Applescript-Users <email@hidden>
>
>
On 8/31/01 8:07 AM, "Arthur J Knapp" <email@hidden> wrote:
>
>
> I just did my own search, and the really funny thing is that this
>
> isn't the first time that I trie d to take credit for this exact same
>
> method:
>
>
>
>
>
>>> Date: Tue, 23 Jan 2001 08:59:46 -0800
>
>>> Subject: Re: "Next" in Repeat?
>
>>> From: Paul Berkowitz <email@hidden>
>
>
>
>>> Somebody. I'm afraid I forget who, once posted an ingenious solution
>
>>> here to
>
>>> meet the lack of a "next repeat" function in AppleScript.
>
>
And I seem to have an excellent memory for remembering to forget who it was
>
every time!
>
>
> Arthur Knapp:
>
>
>
>
>
>> Oh, I'll take credit, I don't mind... (though I wouldn't describe
>
>> myself as a "lurker"). ;-)
>
>
>
>
>
> I love ya, Ray Robertson... ;-)
>
>
Yeah, me too.
>
>
--
>
Paul Berkowitz
>
>
--__--__--
>
>
Message: 8
>
Date: Fri, 31 Aug 2001 08:31:32 -0700
>
To: <email@hidden>
>
From: Jon Pugh <email@hidden>
>
Subject: Re: KinderShell
>
>
At 7:45 AM +0000 8/31/2001, Greg Strange wrote:
>
>I don't use OS X enough to know if this works but given its BSD layer and
>
>something like KinderShell OSAX you could issue the terminal command "ps -A"
>
>which will give you a list of processes. Beware though that is just a
>
>guess.
>
>
Yes, and I forgot to mention Ed Lai, the man who implemented the Apple Event Manager, which is both awesome and evil in its network transparency and use of generic AEDesc handles which has caused most of the changes to the Apple Event Manager in OSX. He's also one of the gods of compatibility, devising new ways to compatibly access old or new code. The XCMD osax, Programmer's Tool and KinderShell are designed to bridge new and old systems. He's also bridged AppleScript and Java in the Java applet code and done some great work making call by name work from AS to/from Java.
>
>
I don't think he's tall enough to be Sauruman though.
>
>
Join
>
>
--__--__--
>
>
Message: 9
>
Date: Fri, 31 Aug 2001 08:33:17 -0700
>
To: AppleScript Users <email@hidden>
>
From: John W Baxter <email@hidden>
>
Subject: Re: applescript-users digest, Vol 2 #1019 - 12 msgs
>
>
At 7:45 +0000 8/31/2001, Greg Strange wrote:
>
>> How do I get a list of running processes on Mac OS X?
>
>>
>
>
>
>I don't use OS X enough to know if this works but given its BSD layer and
>
>something like KinderShell OSAX you could issue the terminal command "ps -A"
>
>which will give you a list of processes. Beware though that is just a
>
>guess.
>
>
ps is a remarkably variable command across Unix flavors... ps -ax looks
>
promising.
>
>
And this is a much better idea than my non-scriptable export from Process
>
Viewer.
>
>
--John (who just crashed Eudora by drag-and-drop between message
>
windows...don't do it if you can)
>
--
>
John Baxter email@hidden Port Ludlow, WA, USA
>
>
--__--__--
>
>
Message: 10
>
Date: Fri, 31 Aug 2001 11:30:26 -0400
>
Subject: Re: processing time & stack overflow!!!
>
From: Arthur J Knapp <email@hidden>
>
To: <email@hidden>
>
>
> Date: Fri, 31 Aug 2001 08:03:05 -0400
>
> From: Victor Yee <email@hidden>
>
> Subject: Re: processing time & stack overflow!!!
>
>
> On Fri, 31 Aug 2001 04:24:15 -0400, monk wrote,
>
>
>
>> can you explain/share to/with us what you did to
>
>> make the script go from an average of 12 minutes to (on my machine) 12
>
>> seconds
>
>
> I basically did what Arthur was telling us to do:
>
>
>
> 1. use his handler ;)
>
> 2. use a reference to the reallyBigList
>
>
Oh, do go on...
>
>
> So, using Arthur's handler reduced that overhead from thousands of repetitions
>
> to just one (he's a smart guy).
>
>
But what do you really think about me?
>
>
> In any case, all thanks for the improved performance of the "cross cutting"
>
> script should go to Arthur (hey, he really is a smart guy! ;)
>
>
Thank you, Victor, but I have a confession to make: it was all the
>
work of Ray Robertson...
>
>
(just trying to beat Shane and Nigel to the punch) ;-)
>
>
Actually, the AppleScript Language Guide, (version 1.3.7 ???),
>
discussed the speed improvements possible via use of the "a ref to"
>
operator:
>
>
<http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
>
/AppleScriptLangGuide/>
>
>
The ASLG is highly recommended reading for everyone.
>
>
The randomizing routine is my "port" of an algorithm I found in Robert
>
Sedgwicks's "Algorithms in C". He was showing how to implement hash arrays,
>
and it occured to me that the hashing technique could easily be modified to
>
created "random" index positions.
>
>
Arthur J. Knapp
>
http://www.stellarvisions.com
>
mailto:email@hidden
>
>
Hey, check out:
>
http://www.seanet.com/~jonpugh/
>
>
--__--__--
>
>
Message: 11
>
Date: Sat, 01 Sep 2001 01:59:40 +1000
>
Subject: Re: Tex-Edit, colorize HTML text?
>
From: Timothy Bates <email@hidden>
>
To: Rachel <email@hidden>, AppleScriptUsers List
>
<email@hidden>
>
>
On 9/1/01 12:04 AM, "Rachel" <email@hidden> wrote:
>
>
> It seems like I have wasted 2 days trying to figure this out.
>
> I want to change every occurrence of a certain font in an HTML text to a
>
> color.
>
tell application "Tex-Edit Plus"
>
tell front window
>
repeat with n from 1 to count of style runs
>
if font of style run n is "Times" then
>
set color of style run n to red
>
end if
>
end repeat
>
end tell
>
end tell
>
>
> In fact, I wish I had a very flexible way to format HTML text.
>
there is an example script that comes with tex-edit to do this
Here's a way to do it without the loop. It's a bit faster:
tell application "Tex-Edit Plus"
replace window 1 looking for "^*" looking for styles {font:"Geneve"} [optn-L]
replacing with "^*" replacing with styles {color:red}
end tell
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/31/01 7:51:44 PM]