[OS X TeX] TeXShop wish list

Paul Smyth psmythirl at mac.com
Mon Sep 4 20:30:48 CEST 2006


Thanks Claus,

that worked perfectly after I added the other suffixes to the  
definition of L.

Paul

On 4 Sep 2006, at 18:31, Claus Gerhardt wrote:

> Paul,
>
> Your Finder suppresses the suffixes. Below is an Applescript that  
> takes care of it.
>
> Claus
>
> --AppleScript
> -- Apply only to an already saved file
> -- Claus Gerhardt, September 2006
> (*This script closes the frontmost (tex) document in TeXShop and  
> removes the corresponding auxilary files the suffixes of which are  
> listed in the list L. Beware of the quotation marks. The list L may  
> contain suffixes to which no corresponding files exist.*)
>
> set L to {"aux", "flashmode"} as list
>
> tell application "TeXShop"
> 	get path of document of window 1
> 	set fileName to result
> end tell
>
>
>
> set {baseName, texName, pdfName, namePath, dirName,  
> dirNameunquoted, logName, logPath, rtfName} to setnamets(fileName)
>
> set theFile to POSIX file namePath 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 baseName
> else
> 	set texName to texName
> end if
>
> tell application "TeXShop"
> 	close document texName
> end tell
>
> repeat with x in L
> 	try
> 		set shellScript to "cd " & dirName & ";"
> 		set shellScript to shellScript & "rm -f  " & baseName & "." & x
> 		do shell script shellScript
> 	end try
> end repeat
>
> on setnamets(x)
> 	set n to (number of characters of contents of x)
> 	set fileNamequoted to quoted form of x
> 	set windowName to do shell script "basename " & fileNamequoted
> 	set m to (number of characters of contents of windowName)
> 	set dirName to quoted form of (characters 1 thru (n - m - 1) of x  
> as string)
> 	set dirNameunquoted to (characters 1 thru (n - m - 1) of x as string)
> 	set theText to contents of windowName as string
> 	
> 	set n to (number of characters of contents of theText)
> 	set i to n as number
> 	
> 	repeat while i > 0
> 		if character i of theText is equal to "." then
> 			set m to i
> 			exit repeat
> 		else
> 			set i to (i - 1)
> 		end if
> 	end repeat
> 	
> 	set baseName to (characters 1 thru (m - 1) of theText as string)
> 	set texName to baseName & ".tex"
> 	set namePath to dirNameunquoted & "/" & baseName as string
> 	set pdfName to namePath & ".pdf" as string
> 	set rtfName to namePath & ".rtf" as string
> 	set logPath to namePath & ".log" as string
> 	set logName to baseName & ".log" as string
> 	
> 	try
> 		tell application "TeXShop"
> 			save document texName
> 		end tell
> 	end try
> 	return {baseName, texName, pdfName, namePath, dirName,  
> dirNameunquoted, logName, logPath, rtfName} as list
> end setnamets
>
> On Sep 4, 2006, at 17:58, Paul Smyth wrote:
>
>> That's the same version I'm using. I only downloaded it a couple  
>> of days ago. I've tried various of my documents but the result is  
>> always the same. Thanks anyway.
>>
>> Paul
>>
>> On 4 Sep 2006, at 12:50, Claus Gerhardt wrote:
>>
>>> I assume your using an old beta. The current beta is 2.10beta2.  
>>> For me the script works fine.
>>>
>>> Claus
>>>
>>>
>>> On Sep 4, 2006, at 13:07, Paul Smyth wrote:
>>>
>>>> Thanks Claus,
>>>>
>>>> I added this as a Macro and I can run it but I'm getting errors.  
>>>> In the current version of TeXShop I get
>>>>
>>>> TeXShop got an error:
>>>> NSReceiverEvaluationScriptError: 4
>>>>
>>>> Same in the current beta.
>>>>
>>>> Note: I have not modified the script in any way.
>>>>
>>>> Paul
>>>>
>>>> On 4 Sep 2006, at 11:24, Claus Gerhardt wrote:
>>>>
>>>>> The Applescript below closes the frontmost tex file and removes  
>>>>> the corresponding .aux files. You can add any other  
>>>>> filename.xxx to be removed by looking at the structure of the  
>>>>> script.
>>>>>
>>>>> Save the script as a Macro to be called by a short key.
>>>>>
>>>>> Claus
>>>>>
>>>>> --AppleScript
>>>>> -- Apply only to an already saved file
>>>>> -- Claus Gerhardt, September 2006
>>>>> (*This script provides the filename and its various derivatives  
>>>>> of the frontmost (tex) document in TeXShop.*)
>>>>>
>>>>>
>>>>>
>>>>> tell application "TeXShop"
>>>>> 	get path of document of window 1
>>>>> 	set fileName to result
>>>>> end tell
>>>>>
>>>>> set {baseName, texName, pdfName, namePath, dirName,  
>>>>> dirNameunquoted, logName, logPath, rtfName} to setnamets(fileName)
>>>>>
>>>>> tell application "TeXShop"
>>>>> 	close document texName
>>>>> end tell
>>>>>
>>>>> set shellScript to "cd " & dirName & ";"
>>>>> set shellScript to shellScript & "rm -f  " & baseName & ".aux"
>>>>> do shell script shellScript
>>>>>
>>>>> on setnamets(x)
>>>>> 	set n to (number of characters of contents of x)
>>>>> 	set fileNamequoted to quoted form of x
>>>>> 	set windowName to do shell script "basename " & fileNamequoted
>>>>> 	set m to (number of characters of contents of windowName)
>>>>> 	set dirName to quoted form of (characters 1 thru (n - m - 1)  
>>>>> of x as string)
>>>>> 	set dirNameunquoted to (characters 1 thru (n - m - 1) of x as  
>>>>> string)
>>>>> 	set theText to contents of windowName as string
>>>>> 	
>>>>> 	set n to (number of characters of contents of theText)
>>>>> 	set i to n as number
>>>>> 	
>>>>> 	repeat while i > 0
>>>>> 		if character i of theText is equal to "." then
>>>>> 			set m to i
>>>>> 			exit repeat
>>>>> 		else
>>>>> 			set i to (i - 1)
>>>>> 		end if
>>>>> 	end repeat
>>>>> 	
>>>>> 	set baseName to (characters 1 thru (m - 1) of theText as string)
>>>>> 	set texName to baseName & ".tex"
>>>>> 	set namePath to dirNameunquoted & "/" & baseName as string
>>>>> 	set pdfName to namePath & ".pdf" as string
>>>>> 	set rtfName to namePath & ".rtf" as string
>>>>> 	set logPath to namePath & ".log" as string
>>>>> 	set logName to baseName & ".log" as string
>>>>> 	
>>>>> 	try
>>>>> 		tell application "TeXShop"
>>>>> 			save document texName
>>>>> 		end tell
>>>>> 	end try
>>>>> 	return {baseName, texName, pdfName, namePath, dirName,  
>>>>> dirNameunquoted, logName, logPath, rtfName} as list
>>>>> end setnamets
>>>>>
>>>>> On Sep 4, 2006, at 5:30, Jan Rosinski wrote:
>>>>>
>>>>>> The following option in TeXShop Preferences would be useful to  
>>>>>> me and maybe other people will find it useful as well. I would  
>>>>>> like to have, as an option to select,  'Trash Aux Files when  
>>>>>> closing a document'. This option, when checked, would reduce  
>>>>>> the clutter in my TeX folders automatically and without any  
>>>>>> problem since creating new aux files is very quick. If you do  
>>>>>> not want it, you can always uncheck it.
>>>>>>
>>>>>> Jan Rosinski
>>>>>> ------------------------- 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/
>>>>>
>>>>
>>>> ------------------------- 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/
>>>
>>
>> ------------------------- 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/
>

------------------------- 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