[OS X TeX] Opustex and TexShop on OSX

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Thu Jun 8 13:43:41 CEST 2006


Teresa,

I have no idea what could be wrong. The macro runs fine here (TS  
2.09c) - I had to omit opusflex of course. One possible explanation  
would be that you didn't copy the subroutine setname that is at the  
end of the script.

Claus


On Jun 8, 2006, at 1:19, Teresa Clark wrote:

>>
>
> Dear Claus
> I saved the attached as a macro named opustex in the macros menu.  
> When I ran it on an existing file it returned the error "<script>  
> doesn't understand the setname message."
>
> Any light appreciated.
>
> Regards
> Teresa Clark
>
>> --Applescript
>> -- Apply only to an already saved file
>> -- Claus Gerhardt, Nov. 2003
>>
>>
>> set frontName to setname(#NAMEPATH#,#TEXPATH#)
>>
>>
>>
>> set fileName to  #NAMEPATH#
>> 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 dirName to quoted form of (characters 1 thru (n - m - 1) of  
>> fileName as string)
>> set texName to baseName & ".tex"
>>
>> set shellScript to "cd " & dirName & ";"
>> set shellScript to shellScript & "~/Library/TeXShop/bin/pdflatexc   
>> " & texName
>> do shell script shellScript
>>
>>
>> set shellScript to "cd " & dirName & ";"
>> set shellScript to shellScript & "~/Library/TeXShop/bin/opusflex   
>> " & baseName
>> do shell script shellScript
>>
>> set shellScript to "cd " & dirName & ";"
>> set shellScript to shellScript & "~/Library/TeXShop/bin/pdflatexc   
>> " & texName
>> do shell script shellScript
>>
>>
>> tell document frontName of application "TeXShop"
>> refreshpdf
>> end tell
>>
>>
>> on setname(x, y)
>> 	set texName to x
>> 	set theFile to POSIX file texName as string
>> 	tell application "Finder"
>> 		if the file theFile exists then
>> 			set theAnswer to "yes"
>> 		else
>> 			set theAnswer to "no"
>> 		end if
>> 	end tell
>> 	if theAnswer is equal to "yes" then
>> 		set texName to quoted form of x
>> 	else
>> 		set texName to quoted form of y
>> 	end if
>> 	set frontName to do shell script "basename " & texName
>> 	tell application "TeXShop"
>> 		save document frontName
>> 	end tell
>> 	return frontName
>> end setname
>
>
>>
> ------------------------- 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