Re: set clipboard fails
Re: set clipboard fails
- Subject: Re: set clipboard fails
- From: Jon Pugh <email@hidden>
- Date: Thu, 25 Oct 2012 18:28:45 -0700
On Oct 25, 2012, at 3:33 PM, Shane Stanley wrote:
> On 26/10/2012, at 9:15 AM, Axel Luttgens <email@hidden> wrote:
>
>> tell application "System Events"
>> set processlist to name of every process
>> set the clipboard to "" & processlist -- removed "contents of"
>> display dialog "" & processlist
>> end tell
>
> You'll notice that because "set the clipboard" is a scripting addition command, it generates an error when directed to System Events and is then resent. It would be better to put it outside the tell block.
>
> And I know using ("" & processList) has its fans, but it seems to me that "as text" or "as string" aren't that much more typing, and are both clearer in intent and, in cases like this, more efficient.
>
>> "the clipboard" vs "clipboard" always has been somewhat controversial, but I currently don't remember the details...
>
> The Standard Additions command requires the "the".
Yes, I wrote the additions “clipboard info”, “the clipboard” and “set the clipboard to” back in the HyperCard days and ported them to AppleScript and finally traded them to Apple for a Mac 8600 back in 1998 or so.
So both follow all scripting addition limitations and require their entire event names to be spelled out precisely. I included the “the” so that applications could implement a “clipboard” property without conflicting.
Shane, of course, has the details correct. I agree with the “as string” part especially in concert with with “the clipboard” since it will be passed as a parameter and allow you to choose which element on the clipboard you want. Use “clipboard info” to see what is currently on the clipboard.
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden