ScreenFloat Application Script: Direct-Paste Floating Shot into Active App

I recently had a feature request to add Direct-Paste to ScreenFloat. I had not idea what that meant, so I looked it up. It basically combines the copy-paste operations into one, immediately pasting the freshly copied content into the currently active, frontmost app’s active window. So instead of having to copy the shot and then pasting it into the active app using command-v (or your method of choice), it’s all done in one go.

Now, there is no way this is allowed in the Mac App Store: ScreenFloat would require the Accessibility sandbox entitlement for it (to emulate the command-v key press), and that’s a big no-no. Why? I have no idea – they do have an entire process of reviewing apps set up for this sort of thing, after all. But I digress.

With the recently released ScreenFloat v2.2, I introduced support for Application Scripts, where users can supply their own, custom-made AppleScripts, and ScreenFloat can run them with a copy of a double-clicked floating shot. With that, it’s possible to set up a direct-paste double-click workflow.
Here’s how.

A floating shot being double-clicked, immediately copy-pasting it into the currently active app, TextEdit.

The AppleScript

The AppleScript is fairly simple, and I’ve prepared it for you to download here (.zip, ~4KB).
It expects the shot already having been copied to the clipboard (doable within the same double-click workflow), and then emulates a command-v key press to paste it into the active, frontmost app’s active window.

After you download and unzip the script, place it into this folder on your Mac:
/Users/yourname/Library/Application Scripts/at.EternalStorms.ScreenFloat-[appstore|trial]/

Now it’s accessible from within ScreenFloat for the Run AppleScript double-click action.

Creating the Double-Click Workflow

Your double-click workflow will consist of two actions:

  1. Copy Shot
    copies the double-clicked shot as a file path, or as image data (png, tiff, etc)
  2. Run AppleScript
    runs the selected AppleScript

To set it up, open ScreenFloat’s Settings, select the Floating Shots tab, and under Double-clicking:, click with the mouse-button and modifier keys of your choice (you can set up multiple double-click workflows for different mouse buttons, with different modifier keys).

Press the + button below and select Copy Shot > Filepath | PNG | TIFF | etc
Press the + button again and select Run AppleScript > Direct-Paste Double-Clicked Shot into Active App

Now, when you double-click a shot with your specified mouse button and modifier keys, the shot will be copied to your clipboard, and then the AppleScript will be executed, pasting the clipboard’s contents (your shot) to the active app’s active window.

That’s it. You can now easily copy-paste floating shots into the active app, without having to do the copy and pasting manually.

Minor Caveat
If you set up the double-click workflow for a mouse button with a bunch of modifier keys, be sure to release the modifier keys as soon as you finish the double-click, otherwise the AppleScript will not send command-v to the active app, but [your pressed modifiers] – v, possibly resulting in a beep.
That’s why I implemented a slight delay into the script (0.5 seconds), which you can adjust yourself by just changing that number, giving you more leeway for releasing the modifier keys you set up for the double-click workflow.


Links

Download AppleScript: Paste into currently active app (.zip, ~4KB)
ScreenFloat Application Scripts Instructions

ScreenFloat Website (+ free trial)
Get to Know ScreenFloat 2 Blog Post Series
ScreenFloat Usage Tips

ScreenFloat on the Mac App Store
Eternal Storms Software Productivity Bundle (includes ScreenFloat, Yoink and Transloader at ~25% off)


Enjoy : )

Comments are closed.