home *** CD-ROM | disk | FTP | other *** search
- Sub MAIN
- ChDir "c:\toolbook"
- Shell "tbook.exe", 0
- tbk = DDEInitiate("ToolBook", "System")
- ' ToolBook ignores startup minimize request
- SendKeys "% n", 1
- DDEExecute tbk, "draw a field from 0,0 to 1,1"
- On Error Goto done ' when user hits Cancel
- expr$ = ""
- While 1
- expr$ = InputBox$("OpenScript expression", \
- "ToolBookDDE", expr$)
- If Left$(expr$, 2) = "! " Then
- ' use ! for statements such as "set blah to blah"
- DDEExecute tbk, Right$(expr$, Len(expr$) - 2)
- Else
- DDEExecute tbk, "put " + expr$ + " into text of selection"
- retval$ = DDERequest$(tbk, "text of selection")
- MsgBox(expr$ + " = " + retval$, "Open Script return value")
- End If
- Wend
- done:
- DDETerminate tbk
- AppActivate "Introducing ToolBook", 1 ' so we can close it
- SendKeys "%{f4}" ' Close
- End Sub