[OS X TeX] Re: Collaborative editing using SubEthaEdit?

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Wed Sep 20 22:41:58 CEST 2006


Download Flashmode-downloadable from

http://www.math.uni-heidelberg.de/studinfo/gerhardt/tex

and install Flashmode-TS according to the instructions, i.e., the two  
Folders have to go inside ~/Library

You can trigger all Applescripts from Flashmode-TS that are not  
Flashmode related - of course Flashmode-TS should be open; I usually  
place its main window in the lower-right corner.

pdflatexc or "pdflatex complete" are what you need.

The script below combines "refreshtext" and pdflatexc. Looking at the  
structure you can replace pdflatexc by any other button name.

I would recommend either to save the script as an application,  
installing its icon in the Dock, or use Apple's universal Script menu  
to call the script directly from Subetha.

Claus


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, docName} to setnametsn(fileName)

tell document docName of application "TeXShop"
	activate
	refreshtext
end tell



set x to "pdflatexc" as string --button name
set y to "Flashmode-TS-Scripts" as string --window name


Flashmode(x, y)

on Flashmode(x, y)
	tell application "Flashmode-TS-Scripts"
		set windowList to title of windows as list
	end tell
	set n to (number of items of windowList) as number
	set i to 1 as number
	repeat while i ² n
		if item i in windowList is equal to y then
			set m to i
			exit repeat
		else
			set i to (i + 1)
		end if
	end repeat
	tell application "Flashmode-TS-Scripts"
		tell window m
			set buttonList to title of buttons as list
		end tell
	end tell
	set n to (number of items of buttonList) as number
	set i to 1 as number
	repeat while i ² n
		if item i in buttonList is equal to x then
			set k to i
			exit repeat
		else
			set i to (i + 1)
		end if
	end repeat
	tell application "Flashmode-TS-Scripts"
		tell window m
			perform action button k
		end tell
	end tell
end Flashmode
on setnametsn(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
	
	set theFile to POSIX file x as string
	tell application "Finder"
		get displayed name of the file theFile
	end tell
	set docName to result
	
	
	return {baseName, texName, pdfName, namePath, dirName,  
dirNameunquoted, logName, logPath, rtfName, docName} as list
end setnametsn------------------------- 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