# Link to Other Program

Call dviout from another program
In the state where dviout has already been started, when dviout is called again with the dvi file as the parameter, whether to start dviout one more time can be controlled (cf. "no more dviout").
forward/backward jump between a TeX editor
This is supported by source specials. The link is done through an executable command with parameters or as a DDE server/client.
Following service support in DDE
Service name
a string starting with dviout(ex. dviout or dvioutj) or WinDVI
Topic name
dviout or dvioutn or WinDVI or the full path name of the current dvi file
Then dviout can be connected as the DDE server. (If more than one dviout are running, the first one will be the default server. If dvioutn is the Topic name, then nth dviout is called.)
After connecting, the following XTYP_EXECUTE transactions and XTYP_REQUEST transactions can be specified.
---------- XTYP_EXECUTE transaction ----------
[WinNormal]The dviout window becomes active.
[WinIconic]The dviout window becomes an icon.
[FileOpen(filename)] "filename" is opened. For example, send a string such as [FileOpen(c:\document\foo.dvi)] or [FileOpen("c:\document\foo.dvi")]. If "filename" is not a full path, the operation cannot be guaranteed.
If "filename" is a directory name, the dialog for selecting the dvi file in that directory is opened.
[FileReopen]indicates reopening and redisplaying the file currently open in dviout.
[PageMove(page)] moves to the specified page. For example, [PageMove(10)][FileReopen] is used.
[PageOpen(page)] indicates the page displayed first in the file opened by the next [FileOpen()].
As on the command line, when the history (cf. File Menu) is used, "page" may not be a number and becomes "h". In this case, filename is not a full path but is searched for in the history.
On the other hand, "l" implies the last page.
For HyperTeX, the display position beginning with a pound sign (#) as in "#name" can be specified. The souce specials are indicated by # line_number source_file or # line_number/string source_file.
[ValueSet(parameter=value)] sets the Parameters. For example, the string of the updated parameters as in [ValueSet(dpi=600 y=B5)] and its value are transmitted.
[FileExit]indicates an automatic exit when the current DDE connection to dviout ends.
[FilePrint]indicates printing the file currently open in dviout. The operation is identical to selecting printing from the menu, and the dialog opens.
[FilePrint(parameter:value ...)] same as above and moreove, change the parameter vaules of the dialog and push [OK] button if necessary.
The necessary ones in the following parameter are indicated by separating by spaces such as
[FilePrint(From:5 To:10 OK:50)]
From:<n><n> is the start page number
To:<n><n> is the last page number to print
Copies:<n><n> is the number to be copied
Reduce:<n><n> is to reduce/magnify. <n> is the number so that 1000 means the equal size
Odd:only even pages
Even:only odd pages
U2page:unite two pages in a sheet
BlankTop:first page is blank in the above
RoghtToLeft:printing right page is first
Ujob:<n>Unite job(<n>==1 means ON and 0 means OFF)
Collate:Collate Copies
Reverse:Reverse order
dviprt:<n>dviprt(<n>==1 means ON and 0 means OFF)
OK:<n>waiting <n>*100 mm sec and push [OK] button. 1000 mm sec = 1 sec is the default. From 0.1 sec to 2 min is possible.
[Function(key)] The function defined by key (with more than 140 types) is executed. The "key" parameter contains Key Symbol, which is the set of the two letters displayed enclosed by square brackets [ ] in the "Key Function Table" view of the "Help->Key table," or they are arranged next to each other.
If written successively, they are executed successively.
For example, [Function(FN)] is the same as [FileReopen], and [Function(FPFX)] is the same as [FilePrint] and [FileExit].
More generally commands in the format of dviout specials are allowed.
---------- XTYP_REQUEST transaction ----------
The value of a Parameter is obtained by giving the parameter name such as TEXPK, y. The return value is the same string as is given after = by Option->All Parameters.
Besides usual parameter name the following can be given.
version Version number of dviout such as 3.03.2.
number The label number of the current dviout.
dvifile The full pathname of the dvi file being previewed. It is NULL string if there exists no such file.
DVIfile Same as above but it is a short filename.
current_page The current page of the dvi file. The return value is as 10(6), which shows "physical page(logical page)".
total_page The last page number of the current dvi file. The return vale is in the same format as above.
time_stamp The timestamp of the current dvi file.
----------------------------------------------
dviout may have the upward compatibility with WinDvi and WinDviPRO.
Since these functions are all independently implemented, there is no need to be concerned about DDE in future function extensions.
Instead of sending multiple commands in order, they can be successively sent once with no spaces as in "[...][...]". The maximum length of the command array is of 1,024 bytes.
Refer to "Example Using DDE".