Service: Clip to Tinderbox v7


(Mark Anderson) #1

http://www.acrobatfaq.com/tbdemos/Clip_Selection_to_Tinderbox_v7.zip

I’ve made a new service to target v7. As with previous ones, it takes the clipboard contents and pastes it ot the front TB’s window view as a new note.

If the app is not open or no doc is open there is a silent fail - by design, I want to keep it simple.


Minor delight: sizing the Tinderbox window
(Desalegn) #2

For Popclip users:

(don’t forget to put Mark’s service into the ~Library/Services/ folder first)


(Andreas Grimm) #3

Thank you for this, @Desalegn


(Desalegn) #4

Glad you find it useful.


(William Jacobs) #5

I am most grateful for this very handy service.


(Mark Ware) #6

This almost but not quite works for me.

If I clip something to Tbx in Outline view, it leaves the new note being edited. This seems to be the standard behaviour for pasting text from the clipboard onto an Outline view.

So if I then clip something else, this second clipping overwrites the first note’s title while leaving the first note text untouched.

I think adding a “return” keysteroke after the paste would fix it?


(Mark Ware) #7

A suggestion for extending the functionality of this service that would make it more useful for me:

if the text is coming from a browser window, also capture the URL and paste that into the new note’s URL attribute.

That way you’d retain the provenance of the clipping.

Obviously I’ve no idea how easy this would be to do!


(Mark Anderson) #8

Checking the code, it does that already!

-- paste clipboard contents
keystroke "v" using command down
-- close the new note from title edit mode
keystroke return

I’ll try a delay.


(Mark Anderson) #9

This seems to work:

-- paste clipboard contents
keystroke "v" using command down
-- v7 needs a short delay (0.05s)
delay 0.05
-- close the new note from title edit mode
keystroke return

I don’t think I can set it any shorter. But the left-in-edit mode issue seems to have gone away.


(Mark Ware) #10

Thanks – now works perfectly for me too!


(Mark Anderson) #11

Service updated (with delay): http://www.acrobatfaq.com/tbdemos/Clip_Selection_to_Tinderbox_v7.zip

I’ll leave the URL bit as an Exercise for the user, as the service works when something in the front app - not necessarily a browser - has a selection. I’m not sure how you tell if the front most app is a browser (given their names can vary. Here’s where in the internal AppleScript (open the service file in automator) you add the extra logic

tell application "System Events" to set activeApplication to bundle identifier of 1st process whose frontmost is true
		set the clipboard to input as Unicode text
		-- add code here to detect app, URL, append URL to above clipboard value

(Mark Anderson) #12

OK, this service only shows up if Safari has focus. It appeans the current tab’s URL to the selection: http://www.acrobatfaq.com/tbdemos/Clip_Safari_Selection-URL_to_Tinderbox_v7.zip. The service doesn’t do any error checking and may fail with complex URLs.

I’ve no idea why these services are MB rather than KB in size. I guess there’s lots of framework stuff bundled in by Automator. Opening the package of the safari service (14MB!) the actual visible assets are c.60kb. I can only assume there are hidden files in the package as zipping only reduces the Zip to c13.7MB. Odd.

If the case of both services, only the first sentence is used for the note title. What I hadn’t noticed is that if a note is selected and focus is in the text pane, the entire clipboard selection is added after the current insertion point, i.e. the insertion point is not moved. Thus if a second such clip is made it will insert before the last one and with no spacing added. As Tinderbox isn’t applescript-able the user will just have to move the cursor themselves between clips if clipping into a note.


(Andreas Grimm) #13

using “Clip_Safari_Selection-URL_to_Tinderbox_v7.zip” for me results in a new note in TB showing twice the clipped ULR in $Text without populating it to $URL.

Is that supposed to work this way?


(Mark Anderson) #14

No, it doesn’t and can’t set $URL as Tinderbox lacks AppleScript support for such an action. Let’s say you’re at www.example.com/somepage.htm and you select 2 sentences “This is one. This is the second”. When you use the clipping and Tinderbox’s focus is - as intended - in the view (left) pane the result is:

$Name: This is one.

$Text:

This is one. This is the second.

www.example.com/somepage.htm

If you’ve put put the focus somewhere else, e.g. the $Text pane you will get an unexpected result.

I’m not a programmer and the service file is not supported software, just something I tried out as a fellow Tinderbox user. If it doesn’t work as desired, you can use Automator to edit it and alter the code to make a new version that suits your needs. I’m no expert in services so likely you’ll have more success than me. :slight_smile:


(Andreas Grimm) #15

Thank you anyway, @mwra


(Jake Bernstein) #16

I’m having difficulty installing this extension. Normally I just download something with the .popclipextz extension and it installs. This is lacking the “z” and well, I just thought I’d ask rather than puzzle it out. #AttorneyNotACoder


(Mark Anderson) #17

If I catch the zeitgeist #ImNotACoderEither, but I’ll try and take a look. :slight_smile:


(Jake Bernstein) #18

Wait, you aren’t a coder? Aren’t you the Tinderbox expert/guy who does the big repository of changelogs? And not a coder.

That actually makes me want to dive into Tinderbox even more because if you aren’t a coder but still make extensive use of TBX that means I can too!


(Desalegn) #19

You can change the extension to ‘z’: doesn’t matter. They are regular zip files. You can extract and zip yourself as well. This is the config file you need to put in.

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Actions</key>
	<array>
		<dict>
			<key>Image File</key>
			<string>hlite.png</string>
			<key>Service Name</key>
			<string>Clip Selection to Tinderbox v7</string>
			<key>Title</key>
			<string>TB</string>
		</dict>
	</array>
	<key>Extension Description</key>
	<string>Make a clip of  with the selected text to TB.</string>
	<key>Extension Identifier</key>
	<string>com.eastgate.Tinderbox-7</string>
	<key>Extension Name</key>
	<string>Clip to Tinderbox</string>
	<key>Required OS Version</key>
	<string>10.7</string>
	<key>Version</key>
	<integer>2</integer>
</dict>
</plist>

(Jake Bernstein) #20

This is what I’m seeing when I rename the .zip from Dropbox to .popclipextz and double click to install to Popclip: