#!/bin/sh
PDFFILE=`echo "$1" | sed -e 's/.[^.]*$/.pdf/'`
PDFBASENAME=`basename ${PDFFILE}`
case $1 in
*.dvi)
dvipdfm -o ${PDFFILE} $1
;;
*.ps)
pstopdf $1 -o ${PDFFILE}
;;
*.pdf)
;;
*)
echo "Don't know how to handle $1" &>2
exit 1
;;
esac
osascript -e "
tell application \"System Events\"
if exists process \"Preview\" then
tell application \"Preview\" to activate
tell process \"Preview\"
tell menu bar 1
if exists menu item of menu \"Fenster\" of menu bar item \"Fenster\" whose name contains \"${PDFBASENAME}\" then
repeat with currentItem in (every menu item of menu \"Fenster\" of menu bar item \"Fenster\" whose name contains \"${PDFBASENAME}\")
click currentItem
click menu item \"Letzte Version\" of menu \"Ablage\" of menu bar item \"Ablage\"
end repeat
else
do shell script \"open $PWD/${PDFFILE}\"
end if
end tell
end tell
else
do shell script \"open $PWD/${PDFFILE}\"
end if
end tell
"
Keine Kommentare:
Kommentar veröffentlichen