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

Michael Sharpe msharpe at ucsd.edu
Sun May 25 14:25:25 EDT 2014


On May 24, 2014, at 1:02 PM, Nicolae Garleanu <garleanu at haas.berkeley.edu> wrote:

> This strikes me as the ``right¹¹, direct way to go about it, rather than
> trying to make use of other commands whose behavior is a bit unclear,
> anyway. (In my case, cmd-f2 does appear to work, but I think that all
> files opened since TexShop was last opened, including the ones closed
> already (even the .plist kind), are included in the list that
> (shft-)cmd-f2 circle through.)
> 

I think one has to go back to a variant of the prior version. The following works for me in both --applescript and --applescript direct modes (I prefer the latter):

tell application "TeXShop"
	activate
	set win to name of window 1
	if win ends with ".pdf" then
		tell application "System Events" to keystroke "1" using command down
	else if win ends with " console" then
		set doclst to documents
		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 n times
				key code 120 using {shift down, command down}
			end repeat
			--now at beginning of TeXShop's internal list of docs
			repeat n times
				tell application "TeXShop" to set thedoc to (name of window 1)
				if (thedoc = doc1) then
					exit repeat
				else
					key code 120 using command down --cmd-F2			
				end if
			end repeat
		end tell
	end if
	tell application "System Events" to keystroke "f" using command down
end tell




More information about the MacOSX-TeX mailing list