Skip to content

Instantly share code, notes, and snippets.

@datMaffin
Created December 4, 2017 22:40
Show Gist options
  • Save datMaffin/c1998372ac5a148791e5fc276eb66992 to your computer and use it in GitHub Desktop.
Save datMaffin/c1998372ac5a148791e5fc276eb66992 to your computer and use it in GitHub Desktop.
Script to reload the PDF-viewer *Skim* in macOS
#!/bin/bash
# the first argument should be the tex file, either with or without extension
file="$1"
[ "${file:0:1}" == "/" ] || file="${PWD}/${file}"
pdffile="${file%.tex}.pdf"
/usr/bin/osascript << EOF
set theFile to POSIX file "${pdffile}" as alias
tell application "Skim"
activate
set theDocs to get documents whose path is (get POSIX path of theFile)
if (count of theDocs) > 0 then revert theDocs
open theFile
end tell
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment