closeComPort TBK-COMM.DLL TBK-COMM.DLL This DLL contains functions to control up to four separate serial ports (COM1 to COM4). The file name of this DLL is TBK-COMM.DLL. closeComPort Closes the port designated by . If the port was not opened, the function has no effect. flushComRxBuffer Flushes out any characters in the receive buffer for a COM port. The characters are lost. flushComTxBuffer Flushes out any characters in the transmit buffer for a COM port. The characters are lost. isComRxReady Checks if there are characters in the receive buffer for a COM port. isComTxReady Checks if there is room in the transmit buffer for a COM port. You can use this function to avoid long waits because writeComPort will loop as long as necessary to avoid overrunning the output buffer. openComPort Opens a serial port for communications. readComPort Reads the characters in the receive buffer for a COM port. Note: The received string will be truncated if it contains a character with a null value (ANSI character zero). setComPort Sets the parameters for a COM port. The port must have been previously opened with openComPort. writeComPort Writes to the transmit buffer of a COM port. Note: There is currently no way to transmit nulls. This capability will be added in a future version. Main List isComRxReady removeRecords Main List displayAspectXY copyFile displayAspectY lastDBRecord isComRxReady exampleHilite isComRxReady TBK-COMM.DLL isComRxReady()- Checks if there are characters in the receive buffer for a COM port. To declare this function, include the following statement in the linkDLL control structure: WORD isComRxReady(WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. The number of bytes in the receive buffer. If the receive buffer is empty, the number is 0. to handle idle if isComRxReady(1) > 0 then put readComPort(1) after text of field "Input" to handle idle if isComRxReady(1) > 0 then put readComPort(1) after text of field "Input" 0,480, isComTxReady isComTxReady isComTxReady TBK-COMM.DLL isComTxReady() Checks if there is room in the transmit buffer for a COM port. You can use this function to avoid long waits because writeComPort will loop as long as necessary to avoid overrunning the output buffer. To declare this function, include the following statement in the linkDLL control structure: WORD isComTxReady(WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. The number of free bytes in the transmit buffer. If the transmit buffer is empty, the number is the same as the size of the buffer. while isComTxReady(1) < 1 if sysTime - MarkTime > 1 then request "Time out error on COM 1" break to system end while get writeComPort(1, TheText) exampleHilite setComPort DLL descriptions openComPort exampleHilite openComPort TBK-COMM.DLL openComPort(,,)S Opens a serial port for communications. Caution: You must call closeComPort before exiting your application, otherwise the port remains unavailable to other applications and will remain unavailable even after you exit Windows. To declare this function, include the following statement in the linkDLL control structure: INT openComPort(WORD,WORD,WORD) is the number of the COM port you want to open, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. is the size of the input buffer the driver will reserve for this port. If is 0, a default buffer size of 1024 bytes will be assumed. Minimum buffer size is 32 characters; maximum i s 32767. is the size of the output buffer the driver will reserve for this port. If is 0, a default buffer size of 128 bytes will be assumed. Minimum buffer size is 32 characters; maximum i s 32767.9 A Windows device handle it successful, or a negative number if it failed The Windows device handle is not used by the other functions in this DLL, but it is returned in case you need to reference the port in calls to other functions.9 if openComPort(1,256,0) >= 0 then request "COM1 opened successfully" request "Could not open COM1" end if INT openComPort(WORD,WORD,WORD) et fName t writeComPort readComPort readComPort TBK-COMM.DLL readComPort() Reads the characters in the receive buffer for a COM port. Note: The received string will be truncated if it contains a character with a null value (ANSI character zero). To declare this function, include the following statement in the linkDLL control structure: STRING readComPort(WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. A string of characters. If the receive buffer was empty, a null string. set Echo to readComPort(1) exampleHilite setComPort setComPort TBK-COMM.DLL setComPort(,,,,,) Sets the parameters for a COM port. The port must have been previously opened with openComPort. To declare this function, include the following statement in the linkDLL control structure: INT setComPort(WORD,WORD,WORD,WORD,WORD,WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. is the baud rate; it can be any baud rate supported by Windows and the COM port hardware, typically 110, 300, 600, 1200, 2400, 4800, 9600 or 19200. is the number of bits in each transmitted character, typically 7 or 8. is the number of stop bits that follow a transmitted character. is 0 for no parity, 1 for odd parity and 2 for even parity. is 0 for no handshaking, 1 for hardware handshaking, or 2 for Xon/Xoff handshaking. A negative number if failed, 0 or a positive number if successful. get openComPort(1, 0, 0) -- Open COM1 with default buffer sizes if it >= 0 then get setComPort(1, 9600, 8, 1, 0, 0) -- 9600 baud, no parity, no handshake if it < 0 then request "Could not open COM1" exampleHilite writeComPort writeComPort TBK-COMM.DLL writeComPort(,) Writes to the transmit buffer of a COM port. Note: There is currently no way to transmit nulls. This capability will be added in a future version. To declare this function, include the following statement in the linkDLL control structure: INT writeComPort(WORD, STRING) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. is anything that evaluates to a string. If it has a numeric value, the string representation of that value is sent. The number of characters sent. If there was an error, the function returns a negative number. if writeComPort(1, "Hello there" & CR) > 0 then request "It worked!" end if exampleHilite closeComPort exampleHilite closeComPort TBK-COMM.DLL closeComPort() Closes the port designated by . If the port was not opened, the function has no effect. To declare this function, include the following statement in the linkDLL control structure: INT closeComPort(WORD) is the number of a COM port. If no error occurs, the function returns a positive number. If there was an error, it returns 0. get closeComPort(1) -- Close COM1 System s Rmn TBK-COMM.DLL Reference - beta L Help lockFields default Qwhich, how -- locks unlocks the fields a list -- recursive encountering a that may contain eBook enterBook reader author leaveBook lockFields enterBook reader sizetopage leaveBook reader lockFields default author lockFields default lockFields field group lockFields which s Rmn -- 2/23/89 Claude O. c"&Edit" c"&Clipboard" "Copy LinkDLL statement" %Example" deActivate "CopyLinkDLLstatement" "&Author" default lockFields /"Function Pages", Descriptions", which, how -- locks unlocks the fields a list -- recursive encountering a that may contain ClearBook "This will contents f"OK" "Cancel" "OK" "Title" "Subtitle" "Syntax" "Returns" "Parameters" List" "Intro Text" "Main trim s s <> cs <> < 32 s <> cs <> s) <= 32 -- filter non- assorted funky ", s) p > 0 cp > 0 ", s) ", s) = 1 Appending "Are you sure want f"Yes" "Help" showImportHelp ("Name file (type should appear titles):" c"." ~(".", ) - 1 & ".DLL" ("File ffN & ".TXT" sendaux( pcount isTitle isSyntax isDescr isTReturns isParameters isExample WaitingForIntro IntroTag (165) & "_" theLine leading LF a)) > 1 SetDLLIntroTxt dfN, & CRLF & <> "Examples" update numbers "ImportFListHelp" setDLLIntroTxt dllName, txt oldPg /<> " "Do a complete sysSuspendMessages findExamples -- Update ront "Sort fList "Done. UpdateDLLPages oldPage dList descriptions" -- We now have a functions their dName fName "What can " && Lmax cL = 0 j <= L = 0 -- "Adding" && " && 4s_searchString ("Search selectedTextState "Cannot " && & "." author first lockFields leaveBook ClearBook import previous showImportHelp setDLLIntroTxt enterBook UpdateDLLPages reader search enterBook reader sizetopage newPage import &Edit &Clipboard Copy LinkDLL statement Clipboard Copy Example Clipboard CopyLinkDLLstatement Copy Example &Author leaveBook default first default previous default default reader lockFields Function Pages lockFields DLL Descriptions default author lockFields Function Pages lockFields DLL Descriptions default lockFields field group lockFields which ClearBook This will clear the contents of all the pages in the book. Cancel Function Pages clear Title Subtitle Syntax Description Returns Example Parameters DLL Descriptions clear Function List Title Subtitle Intro Text Main List Main List default import Title Function Pages Are you sure you want to import? Cancel showImportHelp Name of DLL file (type name as it should appear in titles): File to import: Function Pages end of file end of file SetDLLIntroTxt y5newPage Title Subtitle Syntax Description Parameters Returns Example Function~ title Syntax Description Parameters Returns Example Examples end of file y5newPage Title Subtitle Syntax Description Parameters Returns Example enterbackground theLine IntroTag WaitingForIntro Example Parameters TReturns Descr Syntax Title isExample isParameters isTReturns isDescr isSyntax isTitle pcount default count Appending showImportHelp ImportFListHelp setDLLIntroTxt DLL Descriptions Title y5newPage Title Title Intro text oldPg dllName Function Pages Title Do a complete sort and update of the book? Function Pages enterbackground findExamples Title Subtitle Sort complete. Update Main Function List? Title Subtitle Main List Main List Done. Update DLL Description Pages? kUpdateDLLPages default fList UpdateDLLPages DLL descriptions Title DLL descriptions DLL descriptions y5newPage Title Subtitle What can the functions in Function list Adding to page Description Function list fName dName dList oldPage fList search Search for: Cancel Cannot find s_searchString :,,,7,m Function Pages ofirstP olastP Activate "CopyLinkDLLstatement" deActivate .nt" "CopyExample" CopyLinkDLLStatement "dummy" " & \ "Description" & CRLF B"Previous" B"Next" fixScroll "Syntax" "Parameters" "Returns" resetFieldSizes "Help" x > 0 expandSyntax 1425,870,8610,5490 oexpSyntax expandDescription 1425,870,8610,5490 oexpDescription expandParameters 1425,870,8610,5490 oexpParameters expandReturns 1425,870,8610,5490 oexpReturns 1425,870,8610,1525 1425,1550,8610,3060 1425,3090,8610,4335 1425,4385,8610,5510 findExamples srch trim( "Title" Lmax cL = 0 i <= LMax <> "-" L > 0 exampleHilite xample enterPage leavePage leaveBackground fixScroll previous CopyLinkDLLStatement author expandSyntax expandDescription enterbackground expandParameters expandReturns resetFieldSizes CopyExample findExamples enterbackground firstP lastP CopyLinkDLLstatement leaveBackground CopyLinkDLLstatement CopyExample CopyLinkDLLStatement dummy Description dummy CopyExample dummy Example dummy enterPage Example Example Example CopyExample CopyExample Previous firstP lastP fixScroll Syntax fixScroll Description fixScroll Parameters fixScroll Returns leavePage resetFieldSizes Example fixScroll previous author Example expandSyntax Description Parameters Returns Syntax expSyntax expandDescription Syntax Parameters Returns Description expDescription expandParameters Syntax Description Returns Parameters expParameters expandReturns Syntax Description Parameters Returns expReturns resetFieldSizes expSyntax expDescription expParameters expReturns Syntax Description Parameters Returns Syntax Description Parameters Returns Syntax Description Parameters Returns expSyntax expDescription expParameters expReturns findExamples Example Title exampleHilite expReturns expParameters false expDescription false :,expSyntax false trim() ? setDrive lastP firstP expDescription resetFieldSizes expandDescription buttonUp buttonUp expDescription resetFieldSizes expandDescription Description Description expDescription resetFieldSizes expandDescription default buttonUp buttonUp expDescription resetFieldSizes expandDescription default dummy Title Subtitle Syntax Description Parameters Returns Syntax Parameters Returns buttonUp buttonUp Go Back Example "Example" exampleHilite buttonUp buttonUp Example exampleHilite exampleHilite Example Example Example Example "subtitle") default buttonUp buttonUp subtitle default Function List For This DLL buttonUp buttonUp first Main List Previous buttonUp buttonUp previous buttonUp buttonUp Returns )(''; expReturns resetFieldSizes expandReturns default buttonUp buttonUp expReturns resetFieldSizes fexpandReturns default Parameters expParameters resetFieldSizes expandParameters default buttonUp buttonUp expParameters resetFieldSizes expandParameters default "Help" buttonUp buttonUp Example buttonUp buttonUp Example Example buttonUp buttonUp Example How to use the DLL Help function description pages: Use the arrow buttons to navigate from function to function in alphabetical order. Click Example to see one or more examples of usage of the function. The Example button remains hidden if there is no example. If there is more text in a field than you can read comfortably, click the name of the field to expand it. When a field is expanded, its name is highlighted. Click the field name again to return it to its normal size, or click another field name to expand that other field. Field sizes are reset automatically when you go to another page. Click Main List for the list of all functions, or Function List For This DLL for a list of all the functions that are available in the same DLL as the function described on this page. The function list for the DLL also contains a short description of the DLL organization and usage. Use the command "Copy LinkDLL Statement" in the edit menu to copy the linkDLL statement for the function on this page onto the clipboard. You will then be able to paste it into a ToolBook script and avoid retyping errors. Syntax expSyntax resetFieldSizes expandSyntax default buttonUp buttonUp expSyntax resetFieldSizes 9expandSyntax default false TBK-COMM.DLL openComPort DLL descriptions rectory ofirstP olastP "Help" 4s_interest "Function List" L > 0 znothing |Info" default B"Previous" B"Next" Lmax cL = 0 i <= LMax L > 0 "Intro Pages" leavePage buttonDown enterbackground buttonDoubleClick enterpage import enterbackground firstP lastP leavePage buttonDown Function List textFromPoint button Function Info s_interest buttonDoubleClick buttonUp Function Info s_interest enterpage Function Info Previous firstP lastP Function List Function List Intro text default s_interest import Function Pages !import lastP firstP Function List Function: Summary:: Function Info -- assumes that will only be able -- the function list Hclicking 4s_interest <> default buttonUp buttonUp default s_interest Info on Selected Function "Help" buttonUp buttonUp Intro Text Title Subtitle buttonUp buttonUp Go Back buttonUp buttonUp first Main List Previous buttonUp buttonUp previous buttonUp buttonUp Function info buttonUp buttonDown buttonUp enterpage buttonDown Example How to use the DLL Description pages Use the arrow buttons to navigate from DLL to DLL in alphabetical order. Click Main List for the list of all functions, or click a function name then Info on Selected Function to go to the details page for that function. You can also double-click a function name for the same result. Using DLL functions Before you can call the functions in a DLL from a script, you must first link the DLL to ToolBook and declare the functions you want to use with the linkDLL control structure. For details, see Appendix B, "Using DLLs with ToolBook," in the Using OpenScript manual.eset automatically when you go to another page. . Field sizes are reset automatically when you go to another page. on described on this page. The function list for the DLL also contains a short description of the DLL organization and usage. usage. and usage. flushComRxBuffer Function Pages flushComRxBuffer exampleHilite flushComRxBuffer TBK-COMM.DLL flushComRxBuffer()5 Flushes out any characters in the receive buffer for a COM port. The characters are lost. To declare this function, include the following statement in the linkDLL control structure: INT flushComRxBuffer(WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. 0 if failed, a positive number if successful. get flushComRxBuffer(1) -- Flush receive queue of COM1K INT flushComRxBuffer(WORD) Main List z) > 1 4s_interest "Main List" L > 0 -- ignore "DLL Info" "Function Lmax cL = 0 i <= LMax L > 0 default Pages" kground buttonDown buttonDoubleClick enterbackground enterpage import enterbackground go back buttonDown Main List textFromPoint button DLL Info Function Info s_interest buttonDoubleClick buttonUp Function Info s_interest enterpage Main List Main List DLL Info Function Info default s_interest import Function Pages !import go back buttonUp buttonUp Go Back Main List Main List closeComPort TBK-COMM.DLL flushComRxBuffer TBK-COMM.DLL flushComTxBuffer TBK-COMM.DLL isComRxReady TBK-COMM.DLL isComTxReady TBK-COMM.DLL openComPort TBK-COMM.DLL readComPort TBK-COMM.DLL setComPort TBK-COMM.DLL writeComPort TBK-COMM.DLL This book documents all the functions contained in the DLLs shipped with ToolBook, version 1.0. ToolBook DLL Function Reference 4s_interest buttonUp buttonUp s_interest Info on Selected DLL Function Info 4s_interest buttonUp buttonUp s_interest Info on Selected Function "help" buttonUp buttonUp Version Copyright Asymetrix Corporation 1989 -- Version 1.0on 1.0 /"function buttonUp buttonUp function pages Browse All Functions DLL info Function info buttonUp buttonDown buttonUp enterpage buttonDown To use this book: Click on the name of a function to select it, then click one of the buttons on the right for details about the function or details about the DLL in which it is available. You can also double-click a function name to go to that function directly. To use DLL functions: You must have "linked in" the function before you can call it in your script. To link in a function, use a statement in the following form: linkDLL (, ....) end linkDLL Example: linkDLL "DOSDLL.DLL" INT fileExists(STRING) end linkDLL If you make any mistake in the linkDLL statement, it may lead to a system crash when the function is called. For more information, see the OpenScript documentation. )18\4 /"DLL Descriptions" buttonUp buttonUp DLL Descriptions Browse DLL Descriptions flushComTxBuffer Importing into the "Function by function" background Import is from an ASCII file, where records and fields are identified by a specific tag at the beginning of the line: "?" for function name "!" for syntax "#" for description ";" for parameters ":" for what the function returns "$" for example Each of the above "fields" can contain empty lines and line breaks. The tag can be inserted as "invisible" style characters in a Microsoft word file. The easiest way to do this is to make them glossary entries and insert it into the file. Sorting must be done manually after the import is complete. Be sure to check the "Example" field of the last imported field for garbage before you sort. C.O. 12/14/89null then set Title to theLine else set Title to Title & CRLF & theLine end if end if if isSyntax and theLine <> "Syntax" if Syntax is null then set Syntax to theLine else set Syntax to Syntax & CRLF & theLine end if end if if isDescr and theLine <> "Description" if Descr is null then set Descr to theLine else set Descr to Descr & CRLF & theLine end if end if if isParameters and theLine <> "Parameters" then if Parameters is null then set Parameters to theLine else set Parameters to Parameters & CRLF & theLine end if end if if isTReturns and theLine <> "Returns" then if TReturns is null then set TReturns to theLine else set TReturns to TReturns & CRLF & theLine end if end if if isExample and theLine <> "Example" and \ theLine <> "Examples" then if Example is null then set Example to theLine else set Example to Example & CRLF & theLine end if end if Parameters is null then set Parameters to theLine else set Parameters to Parameters & CRLF & theLine end if end if if isTReturns and theLine <> "Returns" then if TReturns is null then set TReturns to theLine else set TReturns to TReturns & CRLF & theLine end if end if if isExample and theLine <> "Example" and \ theLine <> "Examples" then if Example is null then set Example to theLine else set Example to Example & CRLF & theLine end if end if end if end if if isParameters and theLine <> "Parameters" then if Parameters is null then set Parameters to theLine else set Parameters to Parameters & CRLF & theLine end if end if if isTReturns and theLine <> "Returns" then if TReturns is null then set TReturns to theLine else set TReturns to TReturns & CRLF & theLine end if end if if isExample and theLine <> "Example" and \ theLine <> "Examples" then if Example is null then set Example to theLine else set Example to Example & CRLF & theLine end if end if set Syntax to Syntax & CRLF & theLine end if end if if isDescr and theLine <> "Description" if Descr is null then set Descr to theLine else set Descr to Descr & CRLF & theLine end if end if if isParameters and theLine <> "Parameters" then if Parameters is null then set Parameters to theLine else set Parameters to Parameters & CRLF & theLine end if end if if isTReturns and theLine <> "Returns" then if TReturns is null then set TReturns to theLine else set TReturns to TReturns & CRLF & theLine end if end if if isExample and theLine <> "Example" and \ theLine <> "Examples" then if Example is null then set Example to theLine else set Example to Example & CRLF & theLine end if end if end if buttonUp buttonUp Go Back ImportFListHelp flushComTxBuffer flushComTxBuffer TBK-COMM.DLL flushComTxBuffer() Flushes out any characters in the transmit buffer for a COM port. The characters are lost. To declare this function, include the following statement in the linkDLL control structure: INT flushComTxBuffer(WORD) is the number of the COM port you want to check, such as 1 for COM1, 2 for COM2, etc. The maximum allowable value is 4. 0 if failed, a positive number if successful. get flushComTxBuffer(1) -- Flush transmit queue of COM1 exampleHilite ImportFListHelp readComPort getDBFieldType setCurrentDirectory checkDBIndex getDriveList selectDBFile setDBFieldTag Main List Main List closeComPort TBK-COMM.DLL flushComRxBuffer TBK-COMM.DLL flushComTxBuffer TBK-COMM.DLL isComRxReady TBK-COMM.DLL isComTxReady TBK-COMM.DLL openComPort TBK-COMM.DLL readComPort TBK-COMM.DLL setComPort TBK-COMM.DLL writeComPort TBK-COMM.DLL This book documents all the functions contained in the TBK-COMM DLL. This library is not shipped with ToolBook 1.0 and is not supported as part of ToolBook. ToolBook TBK-COMM.DLL Function Reference 4s_interest buttonUp buttonUp s_interest Info on Selected DLL Function Info 4s_interest buttonUp buttonUp s_interest Info on Selected Function "help" buttonUp buttonUp Version Copyright Asymetrix Corporation 1989 -- Version 1.0on 1.0 /"function buttonUp buttonUp function pages Browse All Functions DLL info Function info )18\4 /"DLL Descriptions" buttonUp buttonUp DLL Descriptions Browse DLL Descriptions buttonUp buttonDown buttonUp enterpage buttonDown To use this book: Click on the name of a function to select it, then click one of the buttons on the right for details about the function or details about the DLL in which it is available. You can also double-click a function name to go to that function directly. To use DLL functions: You must have "linked in" the function before you can call it in your script. To link in a function, use a statement in the following form: linkDLL (, ....) end linkDLL Example: linkDLL "TBKFILE.DLL" INT fileExists(STRING) end linkDLL If you make any mistake in the linkDLL statement, it may lead to a system crash when the function is called. For more information, see the OpenScript documentation. You can use the Copy LinkDLL Statement command in the Clipboard menu to put the statement onto the clipboard, from which you can paste it without errors into your script.