Dynamic Data Exchange

If your editor supports DDE, you can use the commands below to:
  1. Test whether the current file you are editing has been changed since the last "Save file" operation.
    DDEEditChanged=FileChanged
  2. If the file has changed, you want to save the current file.
    DDEEditSaveCommand=[FileSave()]
  3. Bring the editor and file into focus (come to the foreground) DDEEditForeground=[ComeToForeground()]
  4. If performing a block compilation, 4TeX will:
    1. Remember the filename of the blocked text.
      1. This is done by the DDEBlockFileName command if it is possible for 4TeX to ask for the file name (i.e. when DDEBlockFileNameMode=Request). E.g. for PFE the line number is given by the DDE command.
        DDEBlockFileName=FileName
      2. If it is not possible for 4TeX to ask for the filename (DDEBlockFileNameMode=Execute) then the DDEBlockFileName command will invoke the editor to send a DDE command to 4TeX in which the filename is stored. E.g., for WinEdit the command will be:
        DDEBlockFileName=DDEOpen("4TeX 5.0","","forall");DDEExe("%%FILE:%f");DDEClose
        Note that the result of this macro will be e.g. the string "%%FILE:c:\texfiles\latexsample.tex" being sent to 4TeX. It indicates that the file name is c:\texfiles\latexsample.tex.
    2. Remove the block from your file.
      DDEBlockCutCommand=[EditCut()]
    3. Remember the line number at the position of the cursor (i.e., this will always be the first line number of the block).
      1. This is done by the DDEBlockLineNumber command if it is possible for 4TeX to ask for the line number (i.e. if DDEBlockLineNumberMode=Request). E.g. for PFE the line number is given by the DDE command DDEBlockLineNumber=LineNumber
      2. If it is not possible for 4TeX to ask for the line number (DDEBlockLineNumberMode=Execute) then the DDEBlockLineNumber command will invoke the editor to send a DDE command to 4TeX in which the line number is stored, e.g. for WinEdt the command will be:
        DDEBlockFileName=DDEOpen("4TeX 5.0","","forall");DDEExe("%%LINE:%l");DDEClose
        Note that the result of this macro will be e.g. the string "%%LINE:122" which is sendt to 4TeX. It indicates that the line number is 122.
    4. Copy the block from the clipboard back to the file, restoring the old situation.
      DDEBlockPasteCommand=[EditPaste()]
  5. When quitting 4TeX several programs started by 4TeX may be terminated (specified by KillProcesses in the 4TEX.INI file). This is a way to kill the editor, but if the editor supports a DDE command to terminate the editor this command should be used. The DDEEditQuit= parameter in the 4TEX.INI files specifies the DDE command to quit the editor.

DDEcommands are always sent after the connection between 4TeX and the editor is made. This connection is established by sending a "DDE Service" and "DDE Topic" message to the editor.

  1. Block compilation:
    DDEBlockService=PFE32
    DDEBlockTopic=Editor
    
  2. Other commands:
    DDEEditService=PFE32
    DDEEditTopic=Editor
    

If you have an editor that supports DDE you can change the DDE parameters in the 4TEX.INI file. Currently 4TeX is known to work thought DDE commands with the following editors:

The appropriate DDE settings for these editors are described below.

PFE

DDEEditService=PFE32
DDEEditTopic=Editor
DDEEditCommand=[FileSave()]
DDEEditChanged=FileChanged
DDEEditQuit=
DDEEditSaveCommand=[FileSave()]
DDEEditForeground=[ComeToForeground()]
DDEBlockService=PFE32
DDEBlockTopic=Editor
DDEBlockFileName=FileName
DDEBlockFilenameMode=Request
DDEBlockLineNumber=LineNumber
DDEBlockLineNumberMode=Request
DDEBlockCutCommand=[EditCut()]
DDEBlockPasteCommand=[EditPaste()]

MED

DDEEditService=med
DDEEditTopic=system
DDEEditQuit=FileSaveAndExit()
DDEEditSaveCommand=FileSaveAll()
DDEEditChanged=
DDEEditForeground=AppWinActivate()
DDEBlockService=med
DDEBlockTopic=system
DDEBlockFilenameMode=Request
DDEBlockFileName=ReqFileName
DDEBlockLineNumberMode=Request
DDEBlockLineNumber=ReqLineNumber
DDEBlockCutCommand=EditCutToClipbrd()
DDEBlockPasteCommand=EditPasteClipbrdLine()

WinEdt

DDEEditService=WinEdt
DDEEditTopic=DDEServer
DDEEditQuit=[CMD("Exit")]
DDEEditSaveCommand=[CMD("Save All")]
DDEEditChanged=
DDEEditForeground=[SetFocus("")]
DDEBlockService=WinEdt
DDEBlockTopic=DDEServer
DDEBlockFilenameMode=Execute
DDEBlockFileName=DDEOpen("4TeX 5.0","","forall");DDEExe("%%FILE:%f");DDEClose
DDEBlocklinenumberMode=Execute
DDEBlockLineNumber=DDEOpen("4TeX 5.0","","forall");DDEExe("%%LINE:%l");DDEClose
DDEBlockCutCommand=[CMD("Erase Clipboard");CMD("Cut")]
DDEBlockPasteCommand=[CMD("Paste")]