[OS X TeX] Placing eps figures
George Gratzer
gratzer at ms.umanitoba.ca
Mon Jun 5 17:32:27 CEST 2006
Claus,
I installed your macro into TeXShop.
Changed the application name to Adobe Illustrator CS.
Ran it.
Got the message:
AppleScript Error
Can't make file
"2G4:Users:gratzer:Library:TeXshop:Scripts:setnamets.scpt" into type
alias.
Of course, 2G4 is the name of my hard disk.
setnamets.scpt was copied from your TeX page and placed in the
appropriate directory.
In the script, I changed the name of the application to "Adobe
Illustrator CS".
GG
On Jun 4, 2006, at 1:15 PM, Claus Gerhardt wrote:
> Below is an Applescript which can be saved as a macro in TeXShop or
> run separately and which will do what George asked for.
>
> Run the macro when the tex file is front most in TS. The pdf file
> should already exist.
>
> The script needs the subroutine setnamets.scpt which can be
> downloaded from my tex page. The subroutine has to be stored in
> ~/Library/TeXShop/Scripts/
>
> You have to insert the name of your Illustrator application in the
> script, since I don't own one.
>
> Claus
>
>
> --AppleScript
> -- Apply only to an already saved file
> -- Claus Gerhardt, June 2006
> (*The script extracts a pdf page, then transforms it to a ps file
> which will be opened in Illustrator.
>
> Important: If the name Preview in the last command is still
> present, then it has to be replaced by the name of your Illustrator
> application.
>
> Run the script when either the tex file or the pdf file is front
> most in TeXShop.
> *)
>
>
> -- In the first dialog enter the papersize (a4, letter or any other
> standard size)
> -- In the following dialog enter your selection of pages like
> -- 3:4,6,8:12 This would be the selection for one output file
> -- It would contain the pages 3-4, 6, and 8-12
>
> tell application "TeXShop"
> get path of document of window 1
> set Filename to result
> end tell
> set scriptPath to (do shell script "dirname " & "~/Library/TeXShop/
> Scripts/ex")
> set scriptPath to scriptPath & "/setnamets.scpt"
> set scriptName to POSIX file scriptPath as alias
> set scriptLiB to (load script scriptName)
> tell scriptLiB
> set {baseName, texName, pdfname, namePath, dirName,
> dirNameunquoted, logName, logPath, rtfName} to setnamets(Filename)
> end tell
>
>
> activate
> set dialogPaper to "Which paper size do you want: a4, a5, a3, letter"
> activate
> set input to the text returned of (display dialog dialogPaper
> default answer "a4" buttons {"Cancel", "Next"} default button "Next")
>
> set dialogSelection to "Your selection for file # 1. The file will
> be saved as " & baseName & "-1.pdf."
> set i to 1 as number
> activate
> set input to input & " " & the text returned of (display dialog
> dialogSelection default answer "" buttons {"Cancel", "Next"}
> default button "Next")
>
>
> set input to input & " " & baseName
>
> set shellScript to "cd " & dirName & ";"
> set shellScript to shellScript & "~/Library/TeXShop/bin/pdfselectc
> " & input
> do shell script shellScript
>
> set pdfname to baseName & "-1.pdf"
> set shellScript to "cd " & dirName & ";"
> set shellScript to shellScript & "/usr/local/bin/gs -
> sDEVICE=pswrite -dNOCACHE -sOutputFile=" & baseName & "-1.ps" & " -
> q -dbatch -dNOPAUSE " & pdfname & " -c quit"
> do shell script shellScript
> set PSName to baseName & "-1.ps"
> set PSName to dirNameunquoted & "/" & PSName
> set theFile to alias (POSIX file PSName)
>
>
> tell application "Preview"
> activate
> 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 Archive: http://tug.org/pipermail/macostex-archives/
>
------------------------- 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 Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list