Subject: | |
From: | |
Reply To: | |
Date: | Fri, 22 May 2009 14:26:26 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Marc,
Something like...
on idle
set CB to the contents of (the clipboard)
set AppleScript's text item delimiters to return
set flag to text item 1 of CB
if flag is in {"hscript", "flag2"} then
actOnFlag(CB)
return 5
else
return 5
end if
end idle
on actOnFlag(CB)
set AppleScript's text item delimiters to return
set {flag, cmd} to text items of CB
if flag is "hscript" then
tell application "Safari"
activate
open location cmd
end tell
set the clipboard to cmd
else
if flag is "flag2" then
do shell script cmd
end if
end if
end actOnFlag
Paul
On May 22, 2009, at 10:01 AM, Marc Bossiere wrote:
> Thank you for that. I didn't know about the "return 5" bit.
>
> But more than putting TO the OS X clipboard, I'm confused trying to
> get FROM
> it. Like if I send a two line clipboard, such as:
> hscript
> www.google.com
> and what I want is for Applescript to act if it sees my "hscript"
> flag is
> the first line (indicating I want it to do something with this
> clipboard).
>
> I would like it to do the following:
> - see the flag
> - take the URL and open it with a browser
> - clear the flag part of the clipboard (so it won't repeat itself)
>
> Later on I could create other types of flags for other things (like
> sending
> simple Applescripts from the emulator)
|
|
|