Using Applescript with Tinderbox

Each morning I run an Applescript that does some admin tasks and opens up the standard set of apps I’m going to use for the day. Naturally one of those apps is Tinderbox. The relevant couple of lines of Applescript are:
tell application “Tinderbox 9” to open “Users:paulzahara:Documents:Tinderbox Files:PZ Daily Journal.tbx”

tell application “Tinderbox 9” to close “Untitled.tbx”

The last line is the issue. Tinderbox always opens a new file called “Untitled.tbx”. I haven’t been able to find a setting to turn this off. No worries, I’ll just get Applescript to close the unwanted file. Except nothing happens. I see that I am not including the full path to the “Untitled.tbx” file so I went to expand the path. Except that I’m not sure where an unsaved file lives!

So, to take this back to a Tinderbox question: “What is the path to an unsaved file?”

ps: Thanks for the sample Daily Journal file. It’s been extremely useful for me.

The is no setting that allows you to stop Tinderbox producing anew file if none is open (though such a feature request has been made). If you have closed the Journal file, the there is only one document open so surely you could address the close call to document 1 or the front document/

A workaround would be to open application “Tinderbox 9”, then close Document 1 and open your Daily document.

Great suggestion Mark.

For the record here is my script snippet:
activate application “Tinderbox 9”
–Applescript will open Tinderbox which will create the “Untitled” file
tell application “Tinderbox 9” to close document 1
– Applescript closes the blank “Untitled” file
tell application “Tinderbox 9” to open “Users:paulzahara:Documents:Tinderbox Files:PZ Daily Journal.tbx”
– Applescript opens the file I want and there are no extra files hanging around

It is funny the things you ingore. I can’t say that I every consciously consider this as an issue. Darn. Now I’m going to think about it. :wink:

Funny - never saw this issue - there is always at least one file open when I close TBX and so if I open it again - voila the same documents are there as before (Mac…). So: why do you close your PZ Daily Journal.tbx before stopping TBX?

Good point. If the default new doc has not been edited then when closing the app the unused new doc is simply destroyed (there is nothing to save/delete).

When I open up for work in the morning I open a bunch of apps some with multiple windows. I’ve got a ton of screen space but I still like to only keep the necessary windows open to try to minimise the clutter. The way it works now is that the Applescript opens Tinderbox with a blank file, Applescript closes the blank window (marginally eliminating a bit of clutter) and then opens my daily journal window in Tinderbox ready for the day. That’s exactly what I was trying to achieve. At night when I close down I might have 2 or 3 Tinderbox files open but at least during the day I haven’t had to stumble over an unused window. Every little bit helps!

Alternatively:

tell application “Finder” to open “Users:paulzahara:Documents:Tinderbox Files:PZ Daily Journal.tbx”
2 Likes