[OS X TeX] Applescript open_selection
Claus Gerhardt
claus.gerhardt at urz.uni-heidelberg.de
Fri Oct 15 15:11:47 CEST 2004
In the script the variable filePath is misspelled (filepath) in
tell application "Finder"
set theFile to (POSIX file filePath as alias)
end tell
but the misspelled version will also run (?).
Claus
On 15.10.2004, at 14:38, Claus Gerhardt wrote:
> Below is an Applescript open_selection with the help of which one can
> open included files in TeXShop. The equivalent of the script I posted
> yesterday for BBEdit.
>
> However, BBEdit must still be installed and running.
>
> Furthermore, the do_menu.scpt must be installed in its proper place.
>
> Let me also mention that TeXShop didn't understand the command
>
> set theFile to (POSIX file filepath as alias)
>
> I had to pass this command to the Finder.
>
> Claus
>
> -- Applescript
> -- open_selection
> -- Apply only to an already saved file.
> -- Claus Gerhardt, Oct. 2004
>
> (* Select the name or the path of an included file, which is supposed
> to be a .tex file, then the script will tell TeXShop to open the
> file. BBEdit must be installed and running.*)
>
>
> tell application "Finder"
> set scriptPath to (do shell script "dirname " &
> "~/Library/TeXShop/Scripts/ex")
> set scriptPath to scriptPath & "/do_menu.scpt" as string
> set scriptName to POSIX file scriptPath as alias
> set scriptLiB to (load script scriptName)
> tell scriptLiB
> do_menu("TeXShop", "Edit", "Copy")
> end tell
> end tell
>
>
>
>
> tell application "BBEdit"
> activate
> set findName to (contents of current clipboard)
> end tell
>
> tell application "TeXShop"
> activate
>
> set fileName to #TEXPATH#
> set n to (number of characters of contents of fileName)
> set fileNamequoted to quoted form of fileName
> set baseName to do shell script "basename " & fileNamequoted
> set m to (number of characters of contents of baseName)
> set dirNameunquoted to (characters 1 thru (n - m - 1) of fileName as
> string)
> set filePath to (dirNameunquoted & "/"& findName &".tex")
> end tell
>
> tell application "Finder"
> set theFile to (POSIX file filepath as alias)
> end tell
>
>
> tell application "TeXShop"
> open theFile
>
> end tell
>
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list