Using DDE with OyezForms
- COM is the recommended external automation route for OyezForms
- See also Using DDE for DMS review
Ensure OYEZFORM.EXE is running before attempting a DDE link up.
Application: OYEZFORM
Topic: OYEZFORM
The following items are supported in the OYEZFORM topic:
FORM
Request: Returns the name of currently displayed form, else "<blank>".
Poke: Ignored.
PAGE
Request: Returns the current page number being used by DDE. This is not necessarily the same as the displayed page. Returns “0” if no form loaded.
Poke: Sets the page on the form to which field IDs apply. Alternative to page command
PAGES
Request: Returns the number of pages in the current form. Returns “0” if no form loaded.
Poke: Ignored.
FIELD
Request: Returns the contents of the currently active field as set by the user or “FILLAT” command.
Poke: Sets the field ID for field requests.
FIELDS
Request: Returns the number of fields on the current DDE selected page.
Poke: Ignored.
FIELDLIST
Request: Returns a list of the field IDs for the current page, separated by commas. IDs are in tabbing order. Suppressed fields are not included unless the “Enable suppressed fields” tools menu option in checked.
Poke: Ignored.
LIBRARY
Request: Returns the name of the currently selected library. Either "Master", "Custom", or "User".
Poke: Sets the library to be used to either "Master", "Custom", or "User". Sets "Master" if library name not valid.
labellist
Request: Returns a list of the field labels for the current page, separated by commas. IDs are in tabbing order with any unlabeled or duplicate entries omitted. Suppressed fields are not included unless the “Enable suppressed fields” tools menu option in checked.
Poke: Ignored.
extendedlabellist
Request: Returns a list of the field labels for the current page, separated by commas. IDs are in tabbing order and unlabeled and duplicate entries are included. Suppressed fields are not included unless the “Enable suppressed fields” tools menu option in checked.
Poke: Ignored.
GetLabel
Request: Returns the label for the currently selected field on the current page.
Poke: Ignored.
ActionsComplete
Request: Returns "0" if an export or other action is still in progress, or a "1" if all actions are finished.
Poke: Ignored.
The DDE link supports the following execute commands, which should conform to the normal execute syntax.
Commands
Form
Creates a new legal form from the template name in the currently selected library.
Parameters:
<name> The name of the legal form which is to be created.
Page
Sets the page on the form to which field IDs apply. Alternative to page poke.
Parameters:
<page> The number of the page
Field
Places the text in the specified field.
Parameters:
<fieldID> The ID of the field into which the text is to be written .
<text> The data to be written.
Finishfilling
Updates the display and instigates printing.
Parameters:
<action> Non-zero causes printing.
Fillat
Positions filling in point for the user to enter data.
Parameters:
<page> The page on which to position the filling in point
<fieldID> The field to be filled
Throwaway
Discards the form from screen. Prompts if form changed.
Discard
Discards the form from screen without prompting.
Exit
Terminates oyezfrms.exe.
Prints the first thru last.
Parameters:
<first page>
<last page>
Store
Saves the form to the file specified in full path. Any existing file is overwritten.
Parameters:
<fullpath> Full path including name and extension. Enclose string in double quotes(") and use forward slash(/) as directory separator.
Load
Opens a saved form. Discard any current form before loading.
Parameters:
<fullpath> Full path including name and extension. Enclose string in double quotes(") and use forward slash(/) as directory separator.
Maximize
Maximizes the form and the oyezform window.
Library
Sets the library to be used to either "Master", "Custom", or "User". Sets "Master" if library name not valid.
Parameters:
<name> Name of library to use.
Minimize
Minimizes the Oyezform window
exporttoPDF
Exports the current form as a PDF version of the legal form.
Parameters:
<fullpath> Full path to the location where the resulting PDF file will be stored.
SetPDFOptionLong
Used to set options in the OyezForms PDF printer.
Parameters:
<option name> The name of the option to be set.
<value> The numeric value the option is to be set to.
SetPDFOptionString
Used to set options in the OyezForms PDF printer.
Parameters:
<option name> The name of the option to be set.
<value> The text the option is to be set to.
Targetprint
Specifies the printer, paper tray and duplex option to be used by the print and finishfilling methods.
Parameters:
<printer> Precise device name of the printer as returned by the Windows system. If the name is invalid, unrecognised or set to an empty string, the default OyezForms printer will be used.
<tray> The integer value to identify the bin from which paper should be fed. The values are from the DMBIN_ enumeration as assigned by Windows in the wingdi.h file. If the value is -1 or invalid for the particular printer, the default tray setting will be used.
<duplex> If set to 1, the printer should operate in duplex mode. If set to 0, the printer should operate in simplex mode. If set to -1, the setting will be the default for the printer.
The values set by this method will remain in effect until changed or OyezForms is terminated. The choices made by this method do not alter the printer selected by the user for manual printing operations.
Examples
[form(com395)][page(1)][field(10,"hello world")][finishfilling(1)]
or[form(iht100)][field(1,hello)][field(2,goodbye)]......
[discard][load("c:/forms/myfile.olf")][page(2)] [field(1,"hello")]
[ print( 2,2 )]
[store("//myserver/forms/myfile.olf")][discard][exit]
Notes
Commands are sent as strings in a DDE Execute. Multiple commands can be used in each execute string and multiple DDE Executes may be used.
Commands are case insensitive and ignore white space except within double quotes. Use "" within double quotes to get ".
Any commands after finishfilling or print in a single execute may be ignored, (i.e. send "discard" and "exit" in a separate execute).
The form command will not work unless screen is clear,( i.e. use throwaway or discard before attempting to create or open another form.
Data is not guaranteed to be displayed on the Oyez form until a finishfilling command has been sent.
Example using DDE from WORD
Sub testms5()
'
' testms5 Macro
' Word 97 Macro created as example of DDE link to OyezForms
'
' Run OyezForms App
q = Shell("p:\oyezfrms95\oyezfrms.exe", vbNormalNoFocus)
' Pause while OyezForms initializes
Pause = Timer + 5
Do While Timer < Pause
Loop
' Init a DDE link to OYEZFORM|OYEZFORM
chan& = DDEInitiate("OYEZFORM", "OYEZFORM")
' load a new form
A$ = "[form(" + Chr$(34) + "LR94C" + Chr$(34) + ")]"
DDEExecute chan&, A$
A$ = "[field(10," + Chr$(34) + "York" + Chr$(34) + ")][finishfilling(0)]"
DDEExecute chan&, A$
' try reading back the form name
B$ = DDERequest(chan&, "Form")
' save to root directory
A$ = "[store(" + Chr$(34) + "c:/mytest.olf" + Chr$(34) + ")]"
DDEExecute chan&, A$
' close down Oyezforms
A$ = "[exit]"
DDEExecute chan&, A$
' terminate the DDE link
DDETerminate chan&
End Sub