Re: Selected text from Terminal?
Re: Selected text from Terminal?
- Subject: Re: Selected text from Terminal?
- From: Dave Stewart <email@hidden>
- Date: Mon, 1 Dec 2003 16:19:47 -0800
On Dec 1, 2003, at 1:07 PM, dave dowling wrote:
>
Dave,
>
>
This works for me in 10.2.8:
>
>
tell application "Terminal"
>
activate
>
set x to contents of window 1
>
end tell
>
>
Maybe it's a Panther thing?
Nope, but maybe the bear is in the details.
Dave's offering made me try it * in it's own dedicated script *. When
that worked I got really confused because I know I tried that (when
working with AS, I typically will try the dictionary first THEN resort
to GUI scripting when I have to and this was in the dictionary!). Then
I tried it again in the "real" script and it failed. This made me open
mine eyes ...
The problem with my script is:
tell application Terminal to activate
... --do some stuff
tell application "System Events"
... --do some other stuff
tell application process "Terminal"
--Note the "process" has to be there for GUI things
...
--This is where I was trying to do this!
...
end tell
end tell
end tell
Funny, it doesn't work in that block. Nest another tell application
"Terminal" inside there and it works like a charm! Of course, being a
perpetual AS newbie I didn't recognize the difference between "tell
application Terminal" and "tell application process Terminal" (not to
say that I do now, just that I finally recognize that they ARE
different:).
I love it when these problems become comprehendible!
Thanks to all again for this great list. Specific thanks to Dennis and
Dave for getting me going again!
>
On Monday, December 1, 2003, at 02:14 PM, Dave Stewart wrote:
>
>
> On Dec 1, 2003, at 6:16 AM, Dennis Cox offered this:
>
>
>
>> Just get the contents of the window, text is not involved.
>
>>
>
>> get contents of window 1
>
>>
>
>> Dennis
>
>
>
>
>
> Hi Dennis!
>
>
>
> That's what I thought, but when I try this:
>
>
>
> set tempContents to (get contents of window 1)
>
>
>
> I get this:
>
>
>
> System Events got an error:
>
> NSCannotCreateScriptCommandError
>
>
>
> (the word "contents" is highlighted in Smile).
>
>
>
> Nothing tricky being attempted yet, this is just trying to grab the
>
> text in the open Terminal window (I'll try something tricky if I can
>
> get this to work).
>
>
>
> I did notice that in the "Attributes" drawer in Bill's PreFab UI
>
> Browser that "selected text" displays no type or value. Does that mean
>
> something important Bill (like "you can't get there from here")?
>
>
>
> Other thoughts, ideas and suggestions warmly welcomed.
>
>
>
> <snip background chatter containing original problem that is now
>
> solved>
Dave Stewart
Aqua-flo Supply (Goleta)
dstewart at aquaflo dot com
"si hoc legere scis nimium eruditiones habes."
(If you can read this, you're overeducated.)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.