Fixed -- the following seems to work fine for embedding:
tell application "Skim"
set _file to front document's file
set _filename to front document's file as string
tell application "Finder" to set _ext to name extension of (info for _file)
close front document
if _ext is "pdf" then
try
if (do shell script "xattr " & quoted form of POSIX path of _filename & " |
grep net_sourceforge_skim-app_notes") is not 0 then
tell application "Finder" to say "embedding"
set cmdPath to "/Applications/Skim.app/Contents/SharedSupport/skimpdf"
do shell script (quoted form of cmdPath) & " embed " & quoted
form of POSIX path of _filename
tell application "Finder" to say "embedded"
end if
on error
tell application "Finder" to say "No new! notes to embed"
end try
end if
end tell
I assigned <cmd>-w to the above AS (using FastScripts). (I reassigned
the File:Close shortcut to something obscure using
Preferences:Keyboard:Keyboard Shortcuts.)
In use, note that AS can run only one instance of a script at a time, so
let one file close and embed before starting on the next.
For unembedding, one can assign a shortcut to File:Convert Notes ... (using
Sys Prefs).
Or, to eliminate the confirming dialog, one can instead use the script I
posted earlier:
tell application "Skim"
set _filename to first document's file as string
if _filename ends with ".pdf" then
save first document
convert notes first document
tell application "Finder" to say "unembedded"
else
tell application "Finder" to say "not a pdf"
end if
end tell
and assign a shortcut to it using FastScripts.
FWIW, I considered periodically running the skimalot script (
http://sourceforge.net/apps/mediawiki/skim-app/index.php?title=Shell_Scripts)
to
embed all pdfs in my Dropbox'd folders. But, given that I access Dropbox
from multiple devices, I prefer the immediacy of the scripts posted above.
Another option I haven't explored is monitoring file changes using Kicker (
http://rubydoc.info/gems/kicker/2.6.1/frames) in a terminal script and
embedding from there. That might be faster and allow closure of multiple
files.
humanengr
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Skim-app-users mailing list
Skim-app-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-users