# Example Using DDE

For example, the following descriptions are made in Hidemaru's macro language.
-------------------------------------------
ddeinitiate "dviout", "dviout";
ddeexecute "[FileExit]";
ddeexecute "[FileOpen(c:\document\foo.dvi)]";
ddeexecute "[FilePrint]";
ddeterminate;
-------------------------------------------
The c:\document\foo.dvi file is opened and the Print dialog appears. When printing ends, the DDE connection ends, and dviout exits.
-------------------------------------------
ddeinitiate "dviout", "dviout1";
if(!result) {
run "dviout ";
ddeinitiate "dviout", "dviout";
}else
$basefile = dderequest("DVIfile");
if(strlen($basefile) < 1)
$basefile = leftstr(filename,strlen(filename3)-3)+"dvi";
if(selecting)
$SrcWord = "/" + gettext(seltopx,seltopy,selendx,selendy);
else $SrcWord="";
ddeexecute "[PageOpen(# "+str(lineno)+$SrcWord+" "+filename3+")]";
ddeexecute "[WinNormal]";
ddeexecute "[FileOpen("+$basefile+")]";
ddeterminate;
-------------------------------------------
This is for the jump to dviout by source specials. If a string (word) is selected, the jump is more accurate.
This jump is valid when the followings are written in the base files foo.tex
......
\input sub/foo1.tex
......
and foo1.tex is edited by Hidemaru.
When foo.tex is edited, the jump is valid even if dviout is not executed.