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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Data from the Screen

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help,

I am working with ROLM PhoneMail and need to Dial-into Multiple systems and accomplish the following.

1. I need to Find how many Nodes on each system.
2. I need to find how many Channels on each Node


When accessing a PhoneMail system the Login-PM.wax script runs which does the following:

1. sends and enter.
2. Sends the UserName at the Login Prompt
3. Sends an Enter
4. Sends the Password at the Password Prompt

When Logging into a PhoneMail System the following appears after runnig the Login script (examples 1 & 2).
NOTE: If the Text is Underlined it is constant otherwise it changes with each system.

EXAMPLE 1 (Single Node System)

Login:

Login: SYSADMIN
Password:
ROLM PhoneMail Version 6.3
(C) Copyright 1989-1997 Siemens Business Communication Systems.
All Rights Reserved.



ROLM PhoneMail Site Id: XXXXX35575


PhoneMail release 6.3.3.

CPU Type of local node is 80386 33MHz.
PhoneMail is active with 12 Channels

Function:


EXAMPLE 2 (Multi Node Systems)

Login:

Login: SYSADMIN
Password:
ROLM PhoneMail Version 6.3
(C) Copyright 1989-1997 Siemens Business Communication Systems.
All Rights Reserved.



ROLM PhoneMail Site Id: XXXXX35575


PhoneMail release 6.3.3.

CPU Type of local node is 80386 33MHz.
PhoneMail (Node 2 of 5) is active with 12 Channels

Function:

If Example-2 happens I need to know that there are 5 Nodes, so the script can login to each node. after the Function prompt appreas I need to Logout of the Node (transmit "Lo^M"), and then connect to the next node (c 3^M") at the "Action:" Prompt, until all Nodes are done, NOT forgetting Node 1.

While logging Into and Out of Node I need to Capture the Number of Channels for each Node.


Any and all suggestions will be appreciated.
 
You can start off with the sample script I have located here:


Another ASPECT user sent it to me a couple years ago and it's a great one. What you can do is look for up to three strings and the procedure will tell you which was received first. In your case, you could have it look for "Function:" (indicating the prompt was received) and "(Node" (which would tell you that you are on a multinode system. The format would be this:

WaitList(10, "Function:", "(Node", $NULLSTR)

The 10 is the number of seconds to look for either "Function:" or "(Node", while $NULLSTR just passes a null string as the third string to (not) search for. I would then modify the WaitListS2 procedure so it looks like this:

PROC WaitListS2
string sLine
integer iLen
string sTemp

WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 2

strlen sLine iLen ;Get length of string

while iLen > 0 ;While the string has at least one character in it...
if rstrcmp sLine " " 1 ;Compare the first character in the string to a space
strdelete sLine 0 1 ;If the first character is a space, delete it from the string
else
exitwhile ;Else exit the while loop
endif
endwhile

substr sTemp sLine 0 1 ;Copy first character
atoi sTemp iNode
ENDPROC

You would also need to add a global integer variable in your main script that would contain the node number for the current connection (currently I have this as iNode in the script above so you could use that variable name if you like). Be aware that the above procedure assumes the node number is not greater than 9.

After the procedure had run, you would check the value of the global string variable WaitListStat (from the link posted above, would need to add to your script). If its value was 1, then the Function: string was received first, indicating a single node system. If it is 2, then this indicates a multi-node system and you would check iNode to see what node you had connected to. If 0, then neither string was received from the remote system.

aspect@aspectscripting.com
 
Knob,

Your assumption that the Node Number will never be greater than 9 is correct (actually it will never be greater than 8).

PhoneMail release 6.3.3.

CPU Type of local node is 80386 33MHz.
PhoneMail (Node 2 of 5) is active with 12 Channels

Function:

If the WaitListStat has a Value of 2 (i.e. Node does show up) is there a way I can capture both the current Node and Total Nodes (i.e., Current = 2 and total = 5)?

The idea behind this script; is to Log into each Node and obtain the Number of Channels for each Node of PhoneMail. Once I know if this is a Multi Node system and the total Number of Nodes I will need to Logout of the Node and lo into the next Node while capturing the Node Number, Number of channels and Total Nodes (how many times to loop).

Any suggestions?
 
Sure, here is a modified version of the WaitListS2 procedure that will get the number of nodes as well (value will be placed in the integer variable iNumNodes):

PROC WaitListS2
string sLine = " 2 of 5) is active with 12 Channels"
integer iLen
string sTemp

WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 2

strlen sLine iLen ;Get length of string

while iLen > 0 ;While the string has at least one character in it...
if rstrcmp sLine " " 1 ;Compare the first character in the string to a space
strdelete sLine 0 1 ;If the first character is a space, delete it from the string
else
exitwhile ;Else exit the while loop
endif
endwhile

substr sTemp sLine 0 1 ;Get node number
atoi sTemp iNode
substr sTemp sLine 6 1 ;Get number of nodes from system
atoi sTemp iNumNodes
ENDPROC

aspect@aspectscripting.com
 
KNOB,

That worked great.

quick question. I am trying to WRITE the Entry Name (SiteName) and Company (Customer Number is stored here) to the fName FILE. Please Note here are the steps I follow

I open the connection directory: KNOB.dir
dial into a site (Entry Name): Knobsville
Area Code: 561
Data Number: 555-1212
Company: 1234567
User ID: Letmein
Password: please

Then I Start my Channel Macro from the Drop Down list of Script Files. The Entry name Writes to the File fine, However the Company Never appears. The following lines of code are in my Macro.

string fName = "Completed"

strcpy sSiteName $DialSelect
fetch dialentry company SiteCMR
; strcpy SiteCMR $Company
strcat fName sSiteName


Do you have any suggestions as to what I may be missing?

As always you assistance is greatly appreciated.


 
Do you have a set dialentry access command earlier in the script so that the script knows which entry it should be accessing with the fetch dialentry command?


aspect@aspectscripting.com
 
knob,

No, as I understand the command I have to tell it what entry number (i.e., index Number) which I don't know, since the script executes after connection and is started manually.
 
Knob,

That was it is started writing to the file. Now I have the Following writing to the file.

fwrite 2 sSiteName 25
fwrite 2 SiteCMR 9
fwrite 2 SiteID 10
finsblock 2 10
fwrite 2 Release 10
fwrite 2 sNode 2
finsblock 2 4
fwrite 2 Channel 4

However, I wanted to have the script write to the same file instead of have a couple hundred different files to open. So I changed the CREATE to Append per your note (Thanks again). However the file keeps writing on the same line and does not start a NEW line for each entry??

Maybe it because I’m not very clear on the use of “fwrite, fputs and finsblock”?
 
The only time you need to use finsblock is if you are wanting to add space in the middle of a file. If you are just writing to a file that you have just created or are appending to, then you can leave this command off.

The main difference between fwrite and fputs, other than not having to specify the string length with fputs, is that fputs will add a carriage return and linefeed to the end of the string that it writes to the file. This will cause each separate string to end up on its own line (fi the TEXT flag was used with the fopen command). However, since you are writing several different strings to the same "line" then you might try changing the last fwrite to an fputs, or adding an fwrite "`r`n" to put the carriage return and linefeed at the end of the line manually.

aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top