The following is an example of two Lotus 123
macros that work together to take data readings from a DDE conversation with the Software
Wedge and place them in a column such that each new reading is added to the bottom of the
column.
Start_Wedge {LET A1,1}
{LAUNCH "C:\WinWedge\WinWedge.Exe
C:\WinWedge\MyConfig.SW3"}
{DDE-OPEN "WinWedge","COM1"}
{DDE-ADVISE "Get_Data","RecordNumber"}
{DDE-EXECUTE "[BEEP]"}
Get_Data {DDE-REQUEST ("B"&@STRING(A1,0)),"Field(1)"}
{LET A1,A1+1}
The macro named "Start_Wedge"
first sets up a counter value (equal to one) in cell A1 and then launches the Software
Wedge so that it will automatically load and activate itself using the configuration file
named "MyConfig.SW3". Next, it opens a DDE conversation between Lotus and the
Software Wedge using the DDE-OPEN macro command. The following DDE-ADVISE statement sets
up Lotus to run the second macro "Get_Data" each time the data in the
RecordNumber DDE item in WinWedge changes. The last line in the
"Start_Wedge" macro sends the DDE command "[BEEP]" to the Software
Wedge and is included here as an example of how to issue DDE commands to WinWedge from
Lotus.
If the Start_Wedge macro is successful, then the second
macro named "Get_Data" will run automatically whenever the RecordNumber DDE item
in WinWedge is incremented (i.e. after each new data record is received). The
DDE-REQUEST command in the Get_Data macro simply retrieves the data from Field(1) in the
Software Wedge and places the data in column B in the row pointed to by the value in cell
A1. The line {LET A1, A1+1} increments the value in cell A1 so that the next time through,
the data from Field(1) will be placed in the cell directly below the last data value.
To use this example, you would simply run the macro
"Start_Wedge" one time when you want to start collecting data. This macro
assumes that WinWedge will be activated for serial port COM1.
|