• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scriptable multi-clipboard utility?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scriptable multi-clipboard utility?


  • Subject: Re: Scriptable multi-clipboard utility?
  • From: Michael Grant <email@hidden>
  • Date: Sun, 09 Mar 2014 13:57:22 -0500

Thanks again! That works with styled text. I also tried it with a group of copied files from the Finder, but when trying to paste them after running the script, only one file was fully restored for pasting in the Finder. The other filenames are still there as text. Still, progress!

Michael


On Sun, Mar 9, 2014 at 1:25 PM, koenig.yvan <email@hidden> wrote:

Le 09/03/2014 à 19:15, Michael Grant <email@hidden> a écrit :

With BBEdit as the active app and running the script from Butler, if I leave out the activate line, the choose from list dialog doesn't get focus regardless of whether I'm telling System Events or SystemUIServer to display it. That in turn means I need to re-activate the front app even if the user cancels, so in the bottom section of the script it's more convenient to leave the if block inside the tell block rather than vice versa.

Turns out I was being dumb about the boolean test — the test wasn't actually failing at all, I was just forgetting to coerce myChoice (a single-item list) to text before setting the clipboard. Duh.

To Chris's suggestion of having a default item in the choose from list dialog, I can type-select without it. Nice to know that's there, though — before I was just arrowing through the whole list.

So, no ready-made ideas for fully restoring the clipboard if it starts out as something other than plain text but coerceable to text? (Like I said before, it's not worth the effort of finding/developing a solution if there's not already a drop-in solution.)




I guess that this edited version does the trick.

tell application "System Events"
set frontApp to (file of first process whose frontmost is true) as text


try
set clipboardRecord to (the clipboard as record) # ADDED
set fullClipText to (the clipboard as text)
activate
set myChoice to (choose from list (paragraphs of fullClipText))
on error
set myChoice to false
end try
end tell

tell application frontApp
activate
if myChoice is not false then
set the clipboard to (myChoice as text)
tell application "System Events" to keystroke "v" using {command down}
delay 0.1
set the clipboard to clipboardRecord # EDITED
end if
end tell

Yvan KOENIG (VALLAURIS, France) dimanche 9 mars 2014 19:23:47




 _______________________________________________
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



--
There's really no such thing as translating. It's all a scam. We basically just make stuff up and try to make it sound plausible.
 _______________________________________________
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

  • Follow-Ups:
    • Re: Scriptable multi-clipboard utility?
      • From: "koenig.yvan" <email@hidden>
References: 
 >Scriptable multi-clipboard utility? (From: Michael Grant <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: Michael Grant <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: "koenig.yvan" <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: "koenig.yvan" <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: Michael Grant <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: "koenig.yvan" <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: Michael Grant <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: "koenig.yvan" <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: Michael Grant <email@hidden>)
 >Re: Scriptable multi-clipboard utility? (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: Scriptable multi-clipboard utility?
  • Next by Date: Re: Scriptable multi-clipboard utility?
  • Previous by thread: Re: Scriptable multi-clipboard utility?
  • Next by thread: Re: Scriptable multi-clipboard utility?
  • Index(es):
    • Date
    • Thread