[/includes/Nav_MainHeader.htm]

  Home
 

A Closer Look at
The Power of Scripting


 

 
    One of the unique features of the KMSYS Worldwide, Inc. line of emulation and application development products is its powerful scripting language. Scripting provides an enormous potential for developers to interface with other Windows applications or end users the ability to record key macros of repetitive keyboard tasks. Just what is a script? Look at it as an application within an application. A user of a KMSYS Worldwide, Inc. application makes a selection that runs a script to perform some task to extend that application's capability.

    For example, a script could be written to scrape a terminal screen from a host application and place the obtained information in a Windows Word document or Excel spreadsheet. A script could gather name, address information from a mainframe transaction system, and create Microsoft Outlook Contact records.

    One of the handiest features of the KMSYS Worldwide, Inc. eXpress emulator line is the built-in script recorder. The user simply uses the recorder to log a series of frequently issued keystrokes and/or keyboard functions and save them in the form of a script. An action key or menu item may be assigned to the script so that the next time the user needs to execute that same sequence of keys, the script will automatically be run when the user presses the action key or selects the menu item.

    The Visual Basic-like scripting language offers close to 200 statements, subroutines and functions, one-quarter of which are specifically designed to address the unique requirements inherent with host communications. With screen scraping, painting capability, and the ability to control host and Windows programs from scripts, there are immense possibilities for developing increased functionality and productivity in any host enterprise.

     

    Option Explicit
    Sub Main()
        Dim MSWordObj as object

        Dim DF_ACCOUNT as String
        Dim DF_CUST_NAME as String
        Dim DF_ADDRESS1 as String
        Dim DF_ADDRESS2 as String
        Dim DF_ADDRESS3 as String
        Dim DF_CITY as String
        Dim DF_STATE as String
        Dim DF_ZIP as String
        Dim DF_PHONE as String

        DF_ACCOUNT = GetScreenText(17, 10, 9)
        DF_CUST_NAME = GetScreenText(17, 11, 30)
        DF_ADDRESS1 = GetScreenText(17, 12, 40)
        DF_ADDRESS2 = GetScreenText(17, 13, 40)
       
    DF_ADDRESS3 = GetScreenText(17, 14, 40)
        DF_CITY = GetScreenText(17, 15, 20)
        DF_STATE = GetScreenText(45, 15, 2)
        DF_ZIP = GetScreenText(55, 15, 6)
        DF_PHONE = GetScreenText(17, 16, 10)
       

        Set MSWordObj = CreateObject("Word.Basic")

        MSWordObj.AppShow
        MSWordObj.FileNewDefault
        MSWordObj.ViewPage
        MSWordObj.InsertPara
        MSWordObj.Insert Rtrim(DF_CUST_NAME) + Chr$(13) + Rtrim(DF_ADDRESS1) + Chr$    (13)
        If Rtrim(DF_ADDRESS2,1) <> "" Then
            MSWordObj.Insert DF_ADDRESS2 + Chr$(13)
        End If
        If Rtrim(DF_ADDRESS3,1) <> "" Then
            MSWordObj.Insert DF_ADDRESS3 + Chr$(13)
        End If
        MSWordObj.Insert Rtrim(DF_CITY) + ", " + Rtrim$(DF_STATE) + " " + Rtrim    (DF_ZIP)
        MSWordObj.InsertPara
        MSWordObj.InsertPara
        MSWordObj.Insert "Dear Valued Customer:"
        MSWordObj.InsertPara
        MSWordObj.InsertPara
        MSWordObj.Insert "The following is your account number and telephone number as stored in our database:"
        MSWordObj.InsertPara
        MSWordObj.Bold 1
        MSWordObj.Insert "Account:" + Chr$(9) + Rtrim(DF_ACCOUNT) + Chr$(13)
        MSWordObj.insert "Phone number:" + Chr$(9) + Rtrim(DF_PHONE)
        MSWordObj.bold 0
        MSWordObj.InsertPara
        MSWordObj.Insert "If either of the above is incorrect, please contact us immediately"
        MSWordObj.InsertPara
        MSWordObj.InsertPara
        MSWordObj.Insert "Sincerely,"
        MSWordObj.InsertPara
        MSWordObj.Insert " John J. Doe"
        MSWordObj.Insert " Customer Services Rep."
        MSWordObj.InsertPara

        If MsgBox("Do you want to actually Print the letter", MB_ICONQUESTION or MB_YESNO, "Print?") = IDYES Then
        MSWordObj.FilePrint
        MsgBox "Your letter has been sent to the printer.", MB_ICONINFORMATION or     MB_SYSTEMMODAL, "Letter Completed"
        Else
            MsgBox "Your letter has NOT been printed", MB_ICONINFORMATION or MB_SYSTEMMODAL, "Not Printed"
        End If
        MSWordObj.FileExit ' Prompt Save Option
    End Sub

     

 
 

Information on the KMSYS Worldwide web server is Copyright (c) 1983-2013. All rights reserved.
All copyrights and trademarks are the property of their respective owners.
For information regarding this site, or to report a problem pertaining to the site, please contact support
License Agreements and PoliciesPrivacy and Cookie Statements

 

.