[OzTeX] TextWrangler is now freeware

Richard Chang chang at csee.umbc.edu
Thu Jan 27 20:03:56 CET 2005


Following up on my own post....

Here's an AppleScript that tells OzTeX to run the file in the topmost window in TextWrangler.  Curious that I could not simply tell OzTeX to open the file and had to resort to a "do shell script" ...

Richard 

---------------------------------------------------------

tell application "TextWrangler"
	try
		set changed to modified of window 1
	on error
		display dialog "No front window"
		tell me to quit
	end try
	
	-- if frontmost window has been modified, get the user to save it or quit
	if changed then
		set response to display dialog "Save changes?" buttons {"Cancel", "OK"} default button "OK"
		if button returned of response is "Cancel" then
			display dialog "Bye!"
			tell me to quit
		else
			try
				save document of (window 1)
			on error
				display dialog "Can't save front window"
				tell me to quit
			end try
		end if
	end if
	
	-- Front most window should have a file name now
	set fName to (file of window 1) as string
	
end tell

--display dialog fName
set UnixFileName to POSIX path of file fName
do shell script "open -a \"OzTeX\" '" & UnixFileName & "'"



More information about the oztex mailing list