[OS X TeX] 1) Search source file when preview is active (`front'). 2) Incremental search

Nicolae Garleanu garleanu at haas.berkeley.edu
Sat May 24 08:49:49 CEST 2014


Thanks, Michael, I¹ll try it out. In the meantime, a quick question: Why
is the first loop necessary? (Or is it just to give me another
idea/example?)

One thought I had had, working under the assumption of being already in a
file associated with the source I wanted (i.e., pdf/console) was to first
execute the cmd-F2 and then shft-cmd-F2. Since I left for later figuring
out how to code that in applescript (now I know!), I didn¹t try it.

Nicolae


>You may find the following code snippet to be useful. It seems to be a
>reliable way to switch the focus from any one of the {.tex,.pdf, console}
>windows to the corresponding .tex window in TeXShop. If there's an easier
>way, I'd like to know it.
>
>tell application "TeXShop"
>	activate
>	set doclst to documents --only the names of the tex docs
>	set doc1 to name of document 1 --always returns tex doc name
>	set n to ((count doclst) - 1)
>	tell application "System Events"
>		key code 120 using {shift down, command down} --shift-cmd-F2
>		repeat with i from 1 to n
>			key code 120 using {shift down, command down}
>		end repeat
>		-- at beginning of list of docs
>		repeat with i from 1 to n
>			if ((name of document 1) = doc1) then
>				exit repeat
>			else
>				key code 120 using command down	--cmd-F2			
>			end if
>		end repeat
>	end tell
>end tell
>
>Michael
>
>
>----------- Please Consult the Following Before Posting -----------
>TeX FAQ: http://www.tex.ac.uk/faq
>List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>List Archive: http://tug.org/pipermail/macostex-archives/
>TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex




More information about the macostex-archives mailing list