Skip to content

Instantly share code, notes, and snippets.

@wulingyun
Created June 19, 2016 14:23
Embed
What would you like to do?
Using Sumatra with WinEdt, add the following code to "WinEdt\Exec\Acrobat OpenDoc.edt", before the line: // GSView
// Sumatra?
FindInString(`%$('AcroRead')`,'SumatraPDF',1,2,1000,1);
IfOK(!"Relax;",!"JMP('not_sumatra')");
Run('%$("AcroRead"); -reuse-instance -inverse-search "\"%B\WinEdt.exe\" \"[Open(|%%f|);SelPar(%%l,8);]\"" "%P\%N.pdf"','%P',0,0,'%N.pdf - SumatraPDF',1,1);
DDEOpen('',"SUMATRA","control",1);
// send a DDE command to perform forward-search
// the format of the DDE command is [ForwardSearch("<pdffilepath>","<sourcefilepath>",<line>,<column>[,<newwindow>, <setfocus>])]
// if newwindow = 1 then a new window is created even if the file is already open
// if focus = 1 then the focus is set to the window
// e.g. [ForwardSearch("c:\file.pdf","c:\folder\source.tex",298,0)]
DDEExe('[ForwardSearch("%P\%N.pdf","%q%n%t",%!l,0,0,0)]');
DDEClose;
RestoreRegisters(1111111111);
Exit;
:not_sumatra:: ===================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment