Hi all,

I'm also interested in forward search of Skim. Someone may need "-g" option for 
displayline
not to bring Skim.app to the foreground. It can be useful to work with wide 
display for keeping 
the focus on editor. The naming "-g" is same manner as "open" command.
If it works, I would like to ask Christiaan to consider this small addition.

-------------------------
#!/bin/bash

# displayline (Skim)
#
# Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE]

if [ $# == 0 -o "$1" == "-h" -o "$1" == "-help" ]; then
   echo "Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE]"
   exit 0
fi

# get arguments
revert=0
bar=0
activate=1

while [ "${1:0:1}" == "-" ]; do
   if [ "$1" == "-r" -o "$1" == "-revert" ]; then
        revert=1;
   elif [ "$1" == "-b" -o "$1" == "-readingbar" ]; then
        bar=1
   elif [ "$1" == "-g" -o "$1" == "-background" ]; then
        activate=0
   fi
   shift
done
line=$1
file="$2"
[ $# -gt 2 ] && source="$3" || source="${file%.pdf}.tex"

# expand relative paths
[ "${file:0:1}" == "/" ] || file="${PWD}/${file}"
[ "${source:0:1}" == "/" ] || source="${PWD}/${source}"

# pass arguments as NULL-separated string to osascript
# pass through cat to get them as raw bytes to preserve non-ASCII characters
echo -ne 
"${line}\x00${file}\x00${source}\x00${revert}\x00${bar}\x00${activate}\x00" | \
   /usr/bin/osascript \
   -e "set theArgv to do shell script \"/bin/cat\"" \
   -e "set AppleScript's text item delimiters to ASCII character 0" \
   -e "set {theLine, theFile, theSource, shouldRevert, shouldShowBar, 
shouldActivate} to text items of theArgv" \
   -e "set theLine to theLine as integer" \
   -e "set theFile to POSIX file theFile" \
   -e "set theSource to POSIX file theSource" \
   -e "set shouldRevert to (shouldRevert as integer) as boolean" \
   -e "set shouldShowBar to (shouldShowBar as integer) as boolean" \
   -e "set shouldActivate to (shouldActivate as integer) as boolean" \
   -e "set thePath to POSIX path of (theFile as alias)" \
   -e "tell application \"Skim\"" \
   -e "  if shouldActivate then activate" \
   -e "  if shouldRevert then" \
   -e "    try" \
   -e "      set theDocs to get documents whose path is thePath" \
   -e "      if (count of theDocs) > 0 then revert theDocs" \
   -e "    end try" \
   -e "  end if" \
   -e "  open theFile" \
   -e "  tell front document to go to TeX line theLine from theSource showing 
reading bar shouldShowBar" \
   -e "end tell" -
--------------------------

Ryohei Seto


------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to