Edit in WriteRoom from DEVONthink Pro

I recently purchased DEVONthink Pro and WriteRoom, and I encountered a need for a smooth workflow. I wrote a few Applescripts that, when combined with Quicksilver triggers, create a nearly seamless interoperation between the two apps.

After installing WriteRoom 2.0 beta, I enabled the "Edit in WriteRoom" functionality in the WriteRoom preferences. Next, I created a hotkey for this menu item in the "Keyboard & Mouse" System Preferences pane. Finally, I closed and reopened DEVONthink Pro. It is important that you use the same hotkey that I used for the script to work: Command-Control-Shift-E. It's a bit convoluted, but it seemed to have the most success working in a large number of applications in my testing.

To simply edit the currently selected DEVONthink record in WriteRoom (also works with records that are already being edited), use the following code: -- Author: sunetos -- Site: adamia.com

tell application "DEVONthink Pro" set win to first think window

try
    set sel to selection in win
    set rec to first item in sel
    set myid to name in rec
    open window for record (rec)
on error

end try

activate
delay 0.1

tell application "System Events"
    tell process "DEVONthink pro"
        keystroke "e" using {command down, control down, shift down}
    end tell
end tell

end tell

For a more powerful script that lets you create a new text record from anywhere ("modeless" functionality), supply the name, launch a WriteRoom editor, monitor the process, commit changes back to DEVONthink, save the record, and finally close the record, use the code below: -- Author: sunetos -- Site: adamia.com

set recordPath to "/Projects/adamia/pending"

tell application "DEVONthink Pro" activate display dialog "What is the name of the new article?" default answer "pending" set newRecordName to text returned of result

delay 0.1

set rec to get record at recordPath
set newRecord to create record with {name:newRecordName, type:txt} in rec

delay 0.1

open window for record (newRecord)

activate
delay 0.1

tell application "System Events"
    tell process "DEVONthink pro"
        keystroke "e" using {command down, control down, shift down}
    end tell
end tell

end tell

--tell application "WriteRoom" to activate -- in case the hotkey wasn't setup, avoid infinite loop

repeat if not (isWriteRoomDone()) then -- Wait for WriteRoom to launch exit repeat else delay 0.5 end if end repeat

repeat if (isWriteRoomDone()) then -- Wait for WriteRoom session to finish exit repeat else delay 0.5 end if end repeat

on isWriteRoomDone() set writeRoomDone to false set writeRoomProcesses to 0 tell application "System Events" set writeRoomProcesses to count (every process whose displayed name is "WriteRoom") end tell if writeRoomProcesses = 1 then set writeRoomDone to false else set writeRoomDone to true end if return (writeRoomDone) end isWriteRoomDone

tell application "System Events" tell process "DEVONthink pro" keystroke "s" using {command down} delay 0.1 keystroke "w" using {command down} end tell end tell

Obviously, your DEVONthink Pro database should not have a group with the path "/Projects/adamia/Pending," so change that first line to the path of the group where you would like these new records to be stored.

If you have any questions or addition requests, just leave a comment. To finish it up, just create a Quicksilver trigger that calls the new script, and you should have a solid workflow for DEVONthink and WriteRoom for easily writing new content whenever you wish!

Comments

I already have WhiteRoom on

I already have WhiteRoom on my MAC computer and I use it for all my writing purposes. I like the distraction free writing of my WhiteRoom. But I don’t have DEVONthink Pro. I really liked the way you worked with the DEVONthink Pro and WhiteRoom together. Thank you so much for providing the required codes too so that I too can try it as I buy DEVONthink Pro. This will be really helpful for all and so I definitely share this post with my colleagues too. John communications as a service

WriteRoom is a very helpful

WriteRoom is a very helpful app that lets you focus on what you just want to write...it is a great alternative to MS Word because it is less cluttered...helping you focus more on your thoughts...I will suggest this app to my writer friend because I'm pretty sure she will really find this handy and helpful.

Indialantic real estate

i am using omni focus for GTD

i am using omni focus for GTD on my mac and ipod touch and like it. i have been looking for a note program where i can enter and read date on my mac and itouch when offline; can sync notes between my mac and ipodtouch; can categorize my notes. i have not found one that does all that. i tried evernote but have problems reading my notes when offline.

I was wondering if i cld adapt omnifocus and use it for notes and somehow keep those categories separate from my GTD info. How cld i do that? I don't want to see all my note categories when i am looking at projects/etc.

My notes wld be info that i want to keep, but are not things to do (i.e. legal info, heath stuff, etc).

comptia a+ | exam 70-536 | itil v3 certification

http://www.watchgy.com

The replica rolex Date is 34mm like the Air-King, but it obviously includes a date function. IIts production began in the late 1950s around the time the steel Datejust was introduced. Retails range from $5,250 with a smooth bezel and Oyster bracelet to $7,000 with an 18K white gold fluted bezel and diamond markers, to $15,050 for 18K Yellow gold on a jubilee bracelet. rolex replica model was once offered in 3 flavors: steel, 18k yellow & steel, and all 18k yellow gold. rolex watches ares now only available in steel or solid yellow gold.

Thanks

Thanks for the comment! I just realized that a previous beta of WriteRoom included WriteOut 2.0 beta for WriteRoom 2.0, so I started messing with it. However, I'm not sure how I actually want the workflow to work. My first thought is to have DEVONthink store RTFs and have it transform from RTF to Markdown for WR, then convert again back to RTF for storing back in DEVONthink. But the more I thought about it, the more I'm thinking I should keep Markdown in DEVONthink for portability purposes. What do you think?

a d a m

Great Work!

Thank you so much for this great work. I too was trying to figure out how to edit in WriteRoom while preserving the original database article. These scripts do the trick.

I look forward to the Markdown update when it is available.

Robert

Post new comment

The content of this field is kept private and will not be shown publicly.