Tinderbox Forum

Share extension

Hi,

Is there a way to use the Share sheet extension with TBX?
Similar to share to Apple Notes or share to Evernote, but then share to TBX?
Or are there any plans to implement this?

Thanks a lot for helping out!

Well this was exactly my line of thinking.
I use e.g. Evernote and Devonthink (v2), and both have their own ‘webclipper’.

I realize that TBX has watched folders in the forms of Evernote- , Finder- and Notes ‘watched folders’
I haven’t successfully set up a system yet, but what I do like or search is e.g. the possibility to select some txt in any browser and then right-click and send selected txt to EN or DTPO. I think it would be a good way to also clip it to TBX directly instead of via EN or Apple Notes.

I agree that some choice would need to be made as to to which TBX DB it should be sent…
Maybe the idea of a kind of ‘main’ always open general DB? Or the capability to set a specific DB as the ‘receptor’?

I believe Dominique Renauld devised an Alfred workflow that would put a note in Tinderbox, but I don’t know how it functioned.

Thanks for the tip Martin, I was not aware of that.
Probably this: http://dominiquerenauld.net/journal2015-2018/22/8/2016/taking-notes-with-alfred-and-tinderbox

iThoughts had a function that would insert something into an existing mind map (which you had to define in advance). I had one which I simply called Inbox.itx which collected new material that could then be copied elsewhere. You could no doubt set up something similar, perhaps with Keyboard Maestro (if you use it) or perhaps even Automator. Or one of the AppleScript whizzes might come up with a script for it.

True, I almost forgot about iThoughts. I have been looking into it lately.
Moreover since it has an excellent iPhone / iPad version and also a windos version…

What do you use then? OPML import / export?

Yes, I recognise that pattern too;
I do that with Zengobi’s Curio, and it indeed adds a source url, very nice.

@mwra once posted a service to clip to Tinderbox, but it doesn’t work for me anymore. Probably ran into a macOS privacy issue.

My thought exactly. I just updated on of the scripts, as the AppleScript references the app by name. So the v7 version needs editing. Here is the code within service “Clip Selection to Tinderbox v7.workflow” with app references updated for Tinderbox v8:

on run {input}
	try
		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
		activate application "Tinderbox 8"
		tell application "System Events"
			tell process "Tinderbox 8"
				tell window 1
					tell splitter group 1
						tell scroll area 1
							-- paste clipboard contents
							keystroke "v" using command down
							-- close the new note from title edit mode
							delay 0.1
							keystroke return
						end tell
					end tell
				end tell
			end tell
		end tell
		activate application id activeApplication
	on error errmsg
		--display dialog "Error while executing service:" & errmsg buttons {"Close"}
	end try
end run

I did the update in Automator as it was the app used to make the service in the first case. I saved it as “Clip Selection to Tinderbox v7.workflow” back into ~/Library/Services/

I switched back to Safari and the service failed saying Safari needed added permission. Agreeing to that I got shown the System Prefs/Privacy tab, Accessibility option. I unlocked the UI using my OS admin password. Safari was listed but not ticked. I ticked it, re-tested and the service worked. Note, depending on your system you might need to add Safari to this list once you’ve given your admin password. I’m on 10.14.6 so I’m not sure if Catalina changes things.

I also have a “Clip Safari Selection-URL to Tinderbox v8.workflow” service which I fixed/enabled in the similar manner to above—the Safari permissoin step isn’t needed as already done. Here’s the AppleScript bit:

on run {input}
	try
		tell application "System Events" to set activeApplication to bundle identifier of 1st process whose frontmost is true
		set dataString to input as Unicode text
		tell application "Safari"
			set theURL to URL of current tab of front window
		end tell
		if theURL is not equal to "" then
			set dataString to dataString & return & return & theURL & return
		end if
		set the clipboard to dataString as Unicode text
		activate application "Tinderbox 8"
		tell application "System Events"
			tell process "Tinderbox 8"
				tell window 1
					tell splitter group 1
						tell scroll area 1
							-- paste clipboard contents
							keystroke "v" using command down
							-- close the new note from title edit mode
							delay 0.1
							keystroke return
						end tell
					end tell
				end tell
			end tell
		end tell
		activate application id activeApplication
	on error errmsg
		--display dialog "Error while executing service:" & errmsg buttons {"Close"}
	end try
end run

Before sharing these, perhaps @ComplexPoint or someone with better AppleScript smarts might want to improve the code above. Both were originally written for Tinderbox v6, before Tinderbox added AppleScript support. So, perhaps there is better more efficient code we can then use and share as a service.

HTH.

Thanks! I’d like to test these. Conservative as I am, I’m still on 10.13.6 :wink:

( I’ll take a look and experiment a little over the weekend - not before Sat evening now though )

Digging further with AppleScript Debugger (Though I’m not an expert at this) it seems the v8 Tinderbox dictionary has no method to interact with the UI - i.e. I can’t find tabs, view/text panes. So perhaps the above methods are still the way to go. Still, I’d yield to somewhat with better AppleScript skills here.

Yay! Didn’t know such old things were still there. For those wondering, as stated the IDs are 4-character , and ‘Cere’ is short for ‘Ceres’ which was the internal (and original?) name for Tinderbox.

Briefly before supper:

  • For Tinderbox 8, of course, you can create a new note with text from elsewhere directly rather than working with splitter groups, scroll areas, and keystrokes.

That part of your script could be replaced, for TBX8+ users, with something analogous to:

tell application "Tinderbox 8"
    tell front document
        make new note with properties {name:" (something from elsewhere) "}
    end tell
end tell
1 Like

Great. Far less script-cruft. The galley beckons here too but looks like a much simpler script is possible.

I failed, I can’t make a new note and assign more that one property. In the case on the selection & URL script I need to make and note and assign “Name” and “Text” properties, but computer says “no”.

For anything beyond the name of a note, you can set the value of a specific attribute:

tell application "Tinderbox 8"
    tell front document
        tell (make new note with properties {name:" Some name from elsewhere "})
            set value of its attribute "Text" to " Some text from elsewhere  "
        end tell
    end tell
end tell
1 Like

Great, that’s working. I notice that if I activate Tinderbox in the UI and here is no open document Tinderbox makes a new one. This doesn’t happen via the AppleScript in my service (workflow). So it looks like it would be sensible to first check there is a front document and if none to make a new document. What would you suggest, based on your greater AppleScript expertise?

first check there is a front document

So perhaps a pattern along these lines ?

tell application "Tinderbox 8"
    set docs to documents
    if 0 < length of docs then
        set doc to item 1 of docs
    else
        set doc to make new document
    end if
    
    
    tell doc
        tell (make new note with properties {name:" Some name from elsewhere "})
            set value of its attribute "Text" to " Some text from elsewhere  "
        end tell
    end tell
end tell

Tada! Works a treat. I’ll update my two services and post shortly, probably in a (linked) new thread with instructions for those not used to adding services.

1 Like

FWIW, if you wanted to add Google Chrome, the corresponding incantation would be very similar:

tell application "Google Chrome"
    set theURL to URL of active tab of front window
end tell
1 Like