A better way to save Word files (and other non-web files)?

I’ve trying to figure out how to save Word files (and other non-web files) directly into folders within databases, just as one is able to do for saving web content from Safari. I know that I can save files into the Global Inbox, and then from the Global Inbox one can then use the floating Groups & Tags panel to drag selected items from the Global Inbox to any group within any open database. But I’ve found that this two-tier function really gums up my works, and represent one of the ways my system breaks down.

Is there another solution to this? Is there another way to save files more directly from an app to a specific folder / database?

Some might suggest that I index files instead of importing them. But this raises a dilemma… I gather many of my files from saving web content from web browsers into DTP. If I index all other files, it would probably create a confusing jumble of files - imported web files, and all other files indexed. Is there another suggested solution?

Thanks!

AFAIK, there’s no direct way to do this, but I use I couple of workarounds that are faster than the two step process @jprint714 described.

  1. If you are starting a document from scratch, use a template – Data > New from Template > …. I have personal folders inside ~/Library/Application Support/DEVONthink Pro 2 for samples of all the document types I’ll be using for my work, and even varieties of them. For example, different Word formats for different clients. I navigate to where I want the document to be in the database, or create a new group, use New from Template, and then open the file and start editing. The new document is already in your database, and the external app will save directly to the database package. I have the Open in external editor icon in my toolbar to make the last step one-click.
  2. If you are going to edit a document that already exists outside of your database (e.g., an email attachment), or create a new document directly in Word or other editor, then attach the folder action script shown below to a folder on the desktop. I keep a folder there named “DT Promptbox” (just so I remember what it’s for.) When I save anything to that folder, the folder action is triggered and a panel like the one in Tools > Show Groups and Tags opens so I can select (or create) the destination group. This works only on the open databases. You can use Automator to create a folder action, or use the OS X “Folder Actions Setup” app to do this. (Note, this particular action does not remove documents from that folder on the Desktop, but it could be scripted to do so. If two documents with the same name are saved to the folder, OS X appends a numeric suffix to the second one and the folder action does not activate. So, use Hazel or something to periodically trash the files in that folder.)

-- Use Folder Actions Setup to add this script to an existing folder
on adding folder items to this_folder after receiving added_items
	try
		if (count of added_items) is greater than 0 then
			tell application id "com.devon-technologies.thinkpro2" to launch
			set theGroup to "Select the destination group"
			repeat with theItem in added_items
				try
					set thePath to theItem as text
					if thePath does not end with ".download:" then
						tell application id "com.devon-technologies.thinkpro2" to import thePath to theGroup
					end if
				end try
			end repeat
		end if
	end try
end adding folder items to

I’m sure other methods could be set up using QuickKeys, Keyboard Maestro, Hazel (which also executes scripts), or other utilities.

Thank you so much for this.

I do use method #1 you outlined, though I find it a bit clunky. I often prefer to open docs in Word and then save them in appropriate folders. And I also download and edit docs, and then want to save them in the right folder. So, I’m happy to employ method #2 But…I have zero experience using scripts, Automater, Folder Actions Setup, etc. So, I’m not sure how to ingest the code you (kindly) provided, and properly set it up, and would welcome further guidance. Thanks! (I do use QuickSilver quite a bit, and am a new Hazel user - in case that helps.)

But this query has me wondering I ought to radically reconsider the way I might want to use DTP…

Right now, I’ve been importing all of my files into DTP (Word, Excel, etc.), and I gather many of my files from saving web content from web browsers into DTP. Should I consider indexing everything instead?

Here’s my dilemma with making the switch… If I index all other files, it would probably create a confusing jumble of files - imported web files, and all other files indexed. But indexed files (unlike imported files) would allow me to keep my folder structure intact in the filesystem. However, it seems that indexing has alway created problems with files that DTP is unable to include (index), which seems like a perennial problem. And I’m troubled by having to consistently using “Update Indexed Items” to maintain the bilateral links between external files / folders and DTP.

Any ideas, suggestions or solutions…? Thanks!

Is there another suggested solution?

Setting up a folder action:

  1. Navigate to ~/Applications/Utilities/AppleScript Editor (or /Applications/Utilities/AppleScript Editor - depending on where you put your apps) and launch it
  2. Copy the script posted above (Select All, then Command C)
  3. Switch to AppleScript Editor, if a new, untitled document does not open, then use File > New
  4. Paste the script in the new document (Command V)
  5. Click Compile on the toolbar
  6. Save the compiled script, naming it anything you want, to ~/Library/Scripts/Folder Action Scripts (create the folder if doesn’t exist)
  7. Create a folder on the Desktop, or wherever, to which you’ll attach the folder action
  8. Navigate to /System/Library/CoreServices/Folder Actions Setup and launch that app
  9. In Folder Actions Setup, you’ll see two columns - in the first column click the + sign at the bottom, navigate to the folder you created in step (7) and click Open
  10. In the second column click the + sign at the bottom of the column, scroll the list and choose the script you saved in step (6) and click Attach
  11. Close Folder Actions Setup and you’re done. Anything dropped on the folder you assigned the action two will cause DEVONthink to prompt you for the destination group

Indexing vs. importing

It’s sort of a meaning-to-life question when it comes to DEVONthink :open_mouth: Something that’s discussed over and again in the forum. I don’t have anything new to add – I do both depending on what I want to accomplish with a given database. I’d suggest you search, find, and read all the sage advice already in the forum on the topic. You won’t find a single right answer. If you’re having trouble indexing specific types of files - that sounds like a different posting or even opening a ticket with Support.

Thank you again for such wonderfully detailed instructions!

And thank you, Korm, for your assistance… I wish you were able to just give me your sage advice re: importing v. indexing! But I understand. I did search through as many documents on the forum as possible to get a sense of which option would be best, but don’t feel I profited from the posts.

Let me ask this question…

Because I use DTP to gather many of my files from saving web content, is there a way to seamlessly export this content to external file / folder structures - and create some sort of auto synchronization that would ensure that new, moved, and deleted files would be indexed? I find myself leaning toward an indexed system, but fear that files, folders, and the organizational structure will slip through the cracks through the back and forth export / indexing that seems to be a part of maintaining an indexed database.

I welcome any other ideas or suggested solutions. And I thank you again for all of your help…

If I understand the scenario correctly, I think it’s a case for not indexing. If you are clipping and saving from the web into DEVONthink – I assume that means using Clip to DEVONthink – and organizing that content in your database by grouping it, perhaps using Classify or See Also & Classify – then I don’t see any value in exporting all that to the filesystem and then indexing it. Especially if you then rearrange groups, add more files, delete others. This is condition where DEVONthink does not excel at keeping indexed file and folder structures in sync – DEVONthink has no features that offer true, unattended automation. Indexing would merely create unproductive, fussy busy work with zero added value – it would drive you batty, and you’d give it up in a week :slight_smile:

Here’s a rule of thumb: if you have to spend time keeping an internal group structure aligned with an external structure in the filesystem, then don’t index.

Another rule of thumb: if your database structure is emergent - always changing as new documents are added, renamed, annotated, replicated, linked, etc., then don’t index.

My final rule of thumb: if you need to replicate documents be careful of indexing - it’s easy to slip up, break the link, and blow away the replicants without warning.

Here are cases where I do index:

  • Folders and subfolders that I share with collaborators in Dropbox or Box
  • Folders that I use as collection points for the ScanSnap - because I don’t like the quality of DEVONthink’s OCR, don’t like the DTPO workflow, and prefer to use external solutions to manage OCR
  • Folders that I index in more than one database – mainly my library of notebooks and diagrams captured with LiveScribe – because the topics in those folders apply to more than one project and/or client
  • My nvALT (my favorite Notational Velocity client) folder which is indexed in multiple databases and synchronized with Simplenote and across iOS devices and between my desktop and laptop
  • Archival folders on auxiliary disk drives that contain long-unused folders and documents from completed work – work that I only need for very occasional reference.
  • Folders that I synchronize with GoodReader on the iPad using Dropbox – because @GR’s annotation features are excellent and its document management tools suit my workflow better than DTTG

Thanks so much again for your reply…

I’ve never actually used Classify or See Also & Classify. I use DTP in the following ways…

-I’ve created a folder structure for my work projects within my databases, and created a DTP template for file structures for specific projects (thanks to your awesome help!). These databases / folder structures typically contain Word, PDF, and occasionally Excel docs. Sometimes I index large media files, like audio files or pics, just to mitigate the amount of memory I’m imposing on DTP.

-I use DTP’s replicants and smart folders to organize files within the databases / folder structures.

-I import (or save to) files from the web to DTP - mostly webpages, RTFs, but increasingly PDFs (since it seems they’re the only format for annotations). I tag and save save these files into the Inbox or directly into the databases / folder structures.

-I now index folders / files with GoodReader for annotating files - thanks again to your awesome help!

Here are the main problems / concerns I’ve had with DTP that I’m trying to remedy…

-Saving Word and Excel files (and other non-web files) directly into folders within databases. Right now, I find the ways of saving such files to DTP rather clunky, and so the databases really gums up my work. Before I had DTP, I simply saved such files in a standard folder structure (w/in an encrypted disk image). I find it much easier to save files this way - but still want to utilize DTP’s replicants and smart folders!

-Having the ability to regularly, automatically back up my DTP databases so that I’d have access to the raw contents – i.e., the files and their corresponding folders – w/o being dependent on the databases themselves. I’ve been seeking this solution in the event that: the databases become corrupted or DT fails for whatever reason.

That’s it!

Based on that, what do you think is the best solution?

Thank you again, Korm!!!

For what?

From everything you’ve written it seems that once you settle on a method to get new documents into DEVONthink (the original point of this thread, I think) and make sure you have good backups, then you’re set.

I guess I was wondering… Based on the way I use DTP, and the problems / concerns I detailed, if you thought it would be better to index rather than import or if you feel I ought to retain the import system I have in place, but find solutions for importing non-web files, and backing up files and the corresponding file structure. I welcome any other guidance / suggestions… Thanks.

I remain eternally grateful for your wonderful script and assistance with the folder action for saving docs into DTP’s groups. A truly brilliant invention - and one that I referred to DTP’s tech support (since I expect it will help many more users).

One quick question… I’ve noticed that there’s a bit of a lag with triggering DTP’s Groups (through using the folder action), and as a result I might not have properly saved a file (or files) in my database. This might be a result of my my computer, which is in the shop - partly because it’s slowing down. Anyway, I’m just bringing this to your attention.

Is there a way to determine if files that are saved through your process are actually ending up in the groups and if files that have been originally saved through your folder actions are being updated through new saves? I’m just trying to account for where the newly saved files weren’t updated…

Thanks for your help!

Don’t worry they do.

Do worry, they aren’t.

I know your question are meant for korm but I can’t resist giving a very different opinion.

Meaning that DevonThink’s artificial intelligence is not important for your purposes.

This kind of use is not DevonThink’s greatest strength. A good file manager does a better job.

This is the kind of purpose for which DevonThink works very well. You can let it do an even better job by using classify and see also.

Right!

You can use OS X’s aliases and saved searches for the same purpose.

I think that these worries are a bit exaggerated, but you can get what you want very easy by using a file manager instead of DevonThink.

Using DevonThink for for your web clippings and the Finder or another file manager for the other projects would make life a lot easier for you.

You’ve piqued my curiosity. Im curious to hear more about how you’d imagine such a file management system interfacing with DTP. Seems complicated to have two systems functioning together in a way in which one can seamlessly collect, store, process, and fine files and info.

There are many ways to do so.

My preferred way is to make the documents in DevonThink available to other projects by means of a big unstructured indexed ‘interface’ folder (similar to the ‘sync DT with Goodreader’ folder suggested in this post: A better way to use MobileSync with GoodReader?).

I replicate the entries of files in DevonThink that I want to make available to other applications to the interface group, move them to the external folder, and put aliases to them in my project folders.

I recommend collapsing the interface group in DT’s outline and excluding it from classify, search and see also.

This isn’t very complicated, provided that you never replicate an entry with an arrow icon behind its name (that icon says: ‘this entry is already in an indexed group’) to an indexed group and you never rename, add or delete files in the interface folder by any other means than DevonThink.

Entry with arrow.png

Weblocation files referring to a group in DevonThink provide an even easier way to ‘interface’ DevonThink with project folders in the finder:

  1. Replicate (or move) entries of all the documents relevant to a certain project to one group in DevonThink or create a smart group that collects all the relevant documents

  2. Select this group in DevonThink and choose ‘Copy item link’ from the contextual menu (this copies a link to this group to the clipboard)

  3. Paste the link in a text document or window (it doesn’t matter where, an OS X sticky, a ‘post a reply’ window in Safari, a note in DevonThink, a Word file you happen to be working on)

  4. Select this link and drag it to the relevant project folder in the Finder (this creates a weblocation file in that folder)

When you double click on this weblocation file the corresponding group opens in DevonThink.

Thanks, @arnow, belatedly, for your replies and assistance. I need to think more about how whether to adopt this method. I suppose I’m a bit reluctant to do much indexing for fear that I would screw up the file paths if I move files around. But I’ll reread what you’ve outlined and think about it further.

I have another related question based on what you wrote re: how to manage files based on storing & saving files into DTP via the trigger script that @korm kindly created.

I fully understand that it’s preferable externally opening files / docs created from DTP templates. But sometimes (for various operational reasons I won’t get into) I chose to create files from an app (e.g. Word) and save it into DT.

So, here’s the question… The fabulous script that @korm created allows one to save documents and files directly into DTP - via a trigger script, and then into the precise group (through the access to the “Show Groups & Tags” pane). But as @arnow pointed out, one has to go through another process in order to save successive changes to these files, namely: close the original file (from within the app it was created and saved), and then find and open it from within DTP - so that after it has been re-opened externally from within DTP, I will be able to save changes to the files.

I’m wondering if anyone you could recommend either a process or a script that will enable the steps I’ve just outline. It’s do-able to close the original stored file, close it, search for the newly stored file in DTP, then reopen it externally. But it would be preferable to automize this process, if possible.

Thanks everyone…

I don’t get the need for a script. You outlined these steps:

  1. Create a document in an app (say, Word).
  2. Save it to DEVONthink (to the Inbox, say, or by using the script @jprint714 mentioned)
  3. Whenever you want to edit the document, use “Open With…” in DEVONthink, or the DEVONthink toolbar “open externally…” icon.
  4. Alternatively, after the first time the document is launched from DEVONthink, use the editor app’s “Open Recent…” menu

Steps 1 and 2, above, only need to be done once - the first time the document is saved to DEVONthink. So, no further scripting is needed.

Step 3 and 4: Speeding up finding the document in DEVONthink? A script isn’t going to be faster.

Step 3 and 4: Opening the document from DEVONthink into the editor app? A script isn’t going to be faster.

So what else needs to be scripted?

Thank you, @korm… You’re right: it might not require further scripting, and might just involve a different process. I don’t mean to be asking for something unreasonable or that’s already easy to do manually. I’ll outline the existing process, just to clarify what I’m doing (and seeking), and then I’ll drop this matter.

(1) Create a document in Word or TextEdit

(2) Save the file into DEVONthink - directly into the database’s precise group, through the access to the “Show Groups & Tags” pane (via the trigger script that @korm created)

To save successive changes to said file:

(3) Close the original file (e.g., from within Word or TextEdit)

(4) Locate the file from within DTP’s database / groups (sometimes an involved process for those of us who have many databases, groups, and subgroups! :slight_smile: )

(5) Re-opened “externally” said from within DTP, to resume work and to save changes to said file.

I’m only asking about this because… when I first used the trigger script, I assumed that I was able to save changes to files that I created in Word, and were stored into DTP’s database / groups (via the aforementioned script)…by just clicking “Save” - and that these changes would be registered to the files that were just stored in DTP. I realized that I needed to follow steps 3 - 5 - otherwise the changes were just being stored in the folder corresponding to the trigger script, and not affecting the files that I had just stored in DTP.

So, I was just wondering if there was another process or script that would better automize steps 3 -5. That’s all.

I thank @korm again for his tremendous help and support. His script has been great, and I strongly suggest that that DTP incorporate it in future versions.

So, IMO, steps 3 and 5 wouldn’t benefit from automation. I get the point about step 4 - though in DEVONthink the Search window is really fast and easy to use in locating something when you don’t know what database it is in.

Over here, I use Default Folder X for my save dialogs because with it I can add OpenMeta tags and/or Spotlight Comments to documents when I save them. So, let’s say I’m working on several Word documents for a project and I want to return to them over the next few days. I’d save them each with an OpenMeta tag like “Project XYZ”. I’d then create a global smart group (i.e., one that is contained in the global sidebar) and that smart group would look at all open databases looking for documents tagged “Project XYZ”. There I’d have a list of the relevant files ready and waiting, regardless of the database or group where they reside. When I’m finished with the project, I just go to the smart group and remove the “Project XYZ” tag from every document, and delete the smart group.

Thanks so much. That approach makes sense. I actually thought of another approach that seems to work as well, and might be simpler in some ways as it won’t require tags. I just created a smart folder that has the following set up:

All of the following are true
Date Added is Today
Kind is Any Document

Even without automation, it’s a super quick way to navigate to the newly added document so that I can follow my steps 3 - 5 in a fairly seamless fashion. Thank you again for your assistance… Really appreciate it, @korm.

Speaking of smart folders (and scripts) do you know if there’s a way to make a Tagged item automatically be assigned a particular label? Thanks!

Aren’t you already tracking this question in another thread?