Tinderbox Forum

Tinderbox Training Video 13 - Working with media in your TBX files (Part 2)

Tinderbox Training Video - Working with media (Part 2)

Level Advanced
Published Date 1/1/21
Tags Tinderbox, aTbRef, Export Code, Note Taking, value(expression), Audio, Images, Video
Video Length 08:32
URL https://youtu.be/5cfzSF3MEDY
Example File TBX - L Working with media (Part 2).tbx (223.0 KB)
Revision 1
TBX Version 8.9

In this lesson, I expand on Tinderbox Training Video - Working with media in your TBX files (Part 1) and show to add captions and attribution (aka source) references to the media files you include in your Tinderbox files.

NOTE: If you want to play with the Action Code in this tutorial just download the example file linked above. It is all there.

TBX - L Working with media (Part 2)

Reference materials

Please rate this lesson, did you find it useful?
    • :grinning:
    • :neutral_face:
    • :confused:

0 voters

1 Like

Michael @satikusala , as usual this is very helpful. I tried to learn from you by outsourcing my media files (pictures at the moment) into a DEVONthink database, but I have a problem with the file name (or better: file path).
The way you show it in the video this is straightforward - a DT database on Google Drive, a directory within that, and inside the media file which you only need reference by file name.
When I try to copy that, however, I find that the path is not so straightforward - if I let the file in the DT database reveal itself in the Finder, the file is in a subdirectory called Files.noindex, then subdirectory png, then subdirectory 8, and only then the filename comes.
How come this is so much easier in your case?

Hey there.

I actually have NOT been storing my images in a DevonThink database, but rather have them stored on a folder on my hard drive. However, having said this, I did try putting an image in a DevonThink DB and am happy to report that the process works. :slight_smile:

The key is to find the path for the DT3 database. Rt mouse click on the img in DB3, click Get Info, and then copy the path. In my case, this results in “/Users/michaelbecker/Databases/Dissertation.dtBase2/Files.noindex/png/c/PerceivedCharacteristicsofInnovatingTheory.png”

You can then break up the elements into attributes:
MediaPath: /Users/michaelbecker/Databases/Dissertation.dtBase2/Files.noindex/png/c
MediaFileName: /PerceivedCharacteristicsofInnovatingTheory.png

MediaDIR won’t be necessary as DT3 does not appear to organize in this way.

You can then create you note in TBX. Here is a simple example: <img src="/Users/michaelbecker/Databases/Dissertation.dtBase2/Files.noindex/png/c/PerceivedCharacteristicsofInnovatingTheory.png" width="" height="">

I did not both to adjust the media width in this example:

Thanks, Michael, for the quick and comprehensive reply!
On second thoughts, there is no reason to put this into a DT database; putting it into a Dropbox folder seems more sensible, since I want to make things as easy as possible (because otherwise I will put fewer pictures into my TBX notes). This now means that I can put the whole media path into the Textexpander snippet and only have $MediaFile in the note itself.
By the way - the snippet works only up to the “>” after height. The bit that starts with the <br> has a problem and prevents text following the </br> from being displayed.
I cannot find the problem - when I delete that part, text after shows up in Preview without problem. Perhaps you can spot the problem - so here it is:
<br>^if($MediaCaption)^^value($MediaCaption)^endif^ ^if($MediaSource)^(Source: ^value($MediaSource)^)^endif^</br>
Many thanks!

Solved the puzzle - another caret was needed before the first endif! Now it computes without problems:

<br>^if($MediaCaption)^<b>^value($MediaCaption)</b>^endif^ ^if($MediaSource)^(^value($MediaSource)^)^endif^</br>

Yes, missing a ^ would certainly break things. I’m glad you figured it out.

Yes, you can inlcude the path in TextExpander, but I find it useful to have it in the TBXConfigNote, that way I have more flexibility to change it later.

1 Like

Just in case anyone is trying the method of keeping images in DEVONthink, and is using two computers, note that the same file may have a different path on each of the computers, although the DEVONthink item link will be the same.

For example, the same jpg file has the path
… Files.noindex/jpg/9/etc. … on my desktop, and
… Files.noindex/jpg/2/etc. … on my laptop.

I have no technical knowledge of the way DEVONthink does its work in its databases, but somehow I doubt there is a way round this. Unless there is some way of substituting a wildcard for the folder number.

1 Like

I’ll need to look into how the DevonTHINK item URL is constructed. I wonder if one can pull an ID number off the path and reconstruct the item URL.