Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm ready for Extra Basic... now what?

Extra Basic Starter Functions

I'm ready for Extra Basic... now what?

by  calculus  Posted    (Edited  )
This question gets asked occasionally, so I thought I'd share a list of 10 functions I teach in my beginning Extra Basic Macro course. While this is not a comprehensive, or even deep list, it will get most people started in programming in Extra Basic.

Above all, look in the help files. Every version of Extra that I've used has very informative help files. You can usually even find a comprehensive list of methods and functions.

calculus


1. SENDKEYS
Definition: Types the desired keys in Extra at the current cursor location. The keys to be sent are a STRING and should be put in parenthesis (ôö). Special keys listed inside the parenthesis should also be in pacmen (<>). A list of special keys can be found in the help files of Extra Basic.

Use: Sess0.Screen.SendKeys(STRING)

Examples:
Sess0.Screen.SendKeys (ôhstqö)
Sess0.Screen.SendKeys (ôhstq<EraseEOF><Enter>ö)
Sess0.Screen.SendKeys (ôhstq<Pf1><Pa2>ö)


2. WaitHostQuiet
Definition: Waits for the specified amount of time to elapse. The NUMBER is in milliseconds (i.e. 3000 = 3 seconds).

Use: Sess0.Screen.WaitHostQuiet (SettleTime)

Example:
Sess0.Screen.WaitHostQuiet (500)


3. Understanding Screen Position

The Extra screen is defined by rows and columns. As a programmer, you can use the Row and Column position to tell the computer where to get data from, or where to send data to. Additionally, you donÆt have to count the rows and columns. The system constantly keeps track of where your cursor is with screen coordinates in the bottom right hand corner of the screen. In this example, the Row is 24 and the Column is 71.


4. MoveTo
Definition: Used to move the cursor to a specific location on the screen.

Use: Sess0.Screen.MoveTo ROW, COL

Example:
Row = 11
Col = 76
Sess0.Screen.MoveTo 11, 76


5. WaitForString

Definition: Stops macro playback until the desired STRING is found. Row and Col are optional. If not given, the program will look for the string across the entire screen.
After 30 seconds or so the macro will start back regardless. This is called a Time Out.

Use: Sess0.Screen.WaitForString STRING, Row, Col

Example: Sess0.Screen.WaitForString "CICS", 1, 73


6. GetString
Definition: Used to get data from the screen. This function will store the data in a variable for later use. A typical use would be to get a KLN, change screens and use the KLN for a new query. You must tell the system the location by row, column. You must also tell the system how many characters youÆd like returned (i.e. the length of the STRING youÆre getting).

Use: VARIABLE_NAME = Sess0.Screen.GetString (Row, Col, String Length)

Example:
Row = 10
Col = 7
Length = 6 (6 Characters ô135343ö)

KLN = Sess0.Screen.GetString (10,7,6)


7. PutString

Definition: Used to put a STRING to a specific location on the screen. This can be a variable youÆve previously gotten using a GETSTRING function, or a specific string you want to send to a certain location. This is helpful if you need to send ôqö to PID for an item query, or in the example to the right, ôBö to the type field.

Use: Sess0.Screen.PutString STRING, Row, Col

Example:
Row = 2
Col = 11
STRING = KLN from previous example

Sess0.Screen.PutString KLN, 2,11
Or
Sess0.Screen.PutString ô135343ö, 2,11
Or
Sess0.Screen.PutString ôbö, 3,11


8. MsgBox

Definition: Used to display information to the user.

Use: Msgbox STRING

Example:
Msgbox ôMacro Finishedö


9. InputBox

Definition: Used to query the user and ask for input.

Use: VARIABLE_NAME = Inputbox STRING

Example: UserResponse = InputBox (ôHow did you like classö)


10. Remarks
Definition: Used to disable certain lines of code without erasing them.

Use:
REM at the front of the line of code
Or
æ at the front of the line of code

Example:
Rem Msgbox ôMacro Finishedö
Or
æMsgbox ôMacro Finishedö
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top