I’m experimenting with the idea of using a group in DTPO to store my scripts(bash, python, ruby, applescript). I would be editing the scripts in an external editor but saving them to DTPO for ease of organization. In my lab we do mostly small scripting confined to a single file or maybe a couple. Has anyone done similar? Is it possible to launch a Terminal window to where these scripts are located in the DTPO database for execution and testing?
You might have a look at the scripts to execute AppleScript/Perl/Shell scripts (see menu Scripts > Execute).
DTPO is working well to store my code, although I don’t know of an easier way to open a terminal in the location of the item other than revealing it in the finder, right clicking on the folder, and selecting open terminal at specific folder. Any ideas for a better solution here?
Edit: Is it possible to create a “Terminal” template that I could open?
This script is stupid, but gets the job done after a fashion
Select a record in a database, run the script.
tell application id "com.devon-technologies.thinkpro2"
try
set myPath to quoted form of POSIX path of (path of the first item of (selection as list) as string)
set cwd to do shell script "echo " & myPath & " | sed 's/\\(\\/.*\\/\\)\\(.*\\)/\\1/g' "
set do_cd to "cd " & quoted form of cwd
set the clipboard to do_cd
end try
end tell
tell application id "com.apple.terminal"
activate
do script with command do_cd
end tell
Be careful with this: you’ll be plopped into the middle of a database’s file structure which is not meant to be manually adjusted. Of course, if the record something indexed in DEVONthink, you’ll be in a possibly safer part of the file system.
Korm you are the god of apple scripting. I found however that emacs opens a shell in the current location also.