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

Problem setting modem properties from script

Status
Not open for further replies.

rhompesch

Programmer
Mar 21, 2005
3
US
I have to dial a bunch of different modems with different speed settings etc. If I pass in the connection options and use DIALNUMBER (as in the code below) to dial directly it fails - I send commands OK but the other modem never responds. But if I dial a Connection Directory entry with the modem properties set properly everything works fine. I've checked and the SET PORT commands are working (checked FAILURE, FETCHed the corresponding value and displayed etc.) and tried moving the SET PORT commands after the DIAL DATA...YIELD...ENDWHILE to no avail. Not sure what the documentation means about the currently selected connection in System panel of Setup. Any help would be appreciated - this is driving me buggy. Thx.

#Define CAPTUREPATH "C:\RawData"
#Define CAPTUREFILE "Capture.txt"

string strPhone, strDefCapPath
long lngBaudrate
integer intDatabits, intStopbits, intParity

proc main

strPhone = s0
strtonum s1 lngBaudrate
strtonum s2 intDatabits
strtonum s3 intStopbits
strtonum s4 intParity

set dial retries 2
set port baudrate lngBaudrate
set port databits intDatabits
set port stopbits intStopbits
set port parity intParity
dialnumber DATA strPhone

pause 1
while $dialing
yield
endwhile

if $CARRIER == 0
fopen 0 "C:\Fuel\RawData\Busy.txt" CREATE
fputs 0 "Busy"
fclose 0
pwexit
endif

CaptureData()

hangup
pwexit

endproc

proc CaptureData


fetch capture path strDefCapPath
set capture overwrite on
set capture path CAPTUREPATH
set capture file CAPTUREFILE
set capture recordmode SCREEN
capture on

transmit "^A200"
waitquiet 3 forever

capture off
set capture path strDefCapPath

endproc
 
Rhompesch,

You say when you dial from the connection directory it works fine? Instead of redefining the modem setting for each dialout, can the script dial each modem directly from the connection directory using the dial command (not dialnumber)?. Here’s a script I use to dial 28 different modems at night to run a switch stat routine. Instead of redefining the modem setting each time I dial out, I send the entire connection directory entry to the variable sCon (sending it the name of the directory entry exactly as it appears in the directory) each time I call the procedure Stat60. With the “dial DATA sCon” statement, it uses all of the settings from that directory entry, not just the phone number. Dunno, maybe it won’t work for you, but I’d give it a try. If you pass the entire directory listing, it should grab all the modem settings as if you dialed straight from the directory.


;*****************************************************
;* NCC SWITCH STATS.WAS (Procomm Aspect Script)
;* Written for the St. Louis Verizon NCC by Ed Doherty
;*
;* Assigns directory and filename values to procedure
;* arguments and calls one of two subroutines (Stat30
;* or Stat60) for each Nortel M1 switch. The script
;* also creates a folder named with today's date on a
;* specified network drive. Return data from switch is
;* then captured into separate files in the folder.
;*
;*****************************************************

;Global variables
integer iDay, iMonth, iYear, iHour, iMin, iSec
string sPass

;*****************************************************
;* Procedure Main
;*
;* Assigns values to Proc arguments and calls either
;* Stat30 or Stat60 for each switch.
;*
;* CALLS: Stat30, Stat60
;*****************************************************

proc main

string sDate, sPath
integer iEvent

ltimeints $LTIME iYear iMonth iDay iHour iMin iSec

strfmt sDate "%02d-%02d-%d" iMonth iDay iYear

dialogbox 0 130 130 127 65 2 "Enter Current Switch Password"
text 1 15 10 100 8 "Switch &Password:" left
editbox 2 15 20 96 14 sPass MASKED
pushbutton 3 15 40 42 14 "&Dial" DEFAULT
pushbutton 4 69 40 42 14 "&Cancel"
enddialog

while 1
dlgevent 0 iEvent
switch iEvent
case -1
exit
case 3
if nullstr sPass
usermsg "Please enter the password."
endif
exitwhile
endcase
case 4
exit
endcase
endswitch
endwhile

dlgdestroy 0 CANCEL

sPath = "X:\docs\Shared_info\Production_Reports\Switch_Stats\"
strcat sPath, sDate
mkdir sPath
pause 1

set capture path sPath

Stat60("Airport Bldg 74","Airport Bus Park BLDG 74")
Stat60("Alaska Bldg 98","Alaska, CA B98")
Stat60("BLDG 2","BLDG 2")
Stat60("BLDG 505","BLDG 505, St. Charles")
Stat60("BLDG 60","BLDG 60")
Stat60("California MD","California,Maryland")
Stat60("Cecil Field","Cecil Field Opt. 11")
Stat60("Charleston","Charleston2")
Stat60("China Lake","China Lake, CA")
Stat60("Crestview","Crestview Florida")
Stat60("Cypress","Cypress CA")
Stat60("Dyess AFB","Dyess AFB")
Stat60("Graham","Graham St. Bldg. 199")
Stat60("Gresham","Gresham, Or")
Stat30("Honda Carson","Honda Carson B170 CAR069")
Stat60("Houston","Houston Towers 2")
Stat60("LBCH Security 802","LBCH Security 802")
Stat60("Leadership Center","Leadership Center Switch")
Stat60("Macon1","Macon, GA")
Stat60("Macon2","Macon2, GA")
Stat60("McChord","McChord")
Stat60("Melbourne","Melbourne, Building 2 New")
Stat60("North Hanley","North Hanley")
Stat60("Oak Ridge","Oakridge Tenn.")
Stat60("Riverport","Riverport")
Stat60("Torrance","Torrance Warehouse")
Stat60("Travel LBCH","TRAVEL (LBCH)")
Stat60("Travel STLS","TRAVEL (STLS)")
usermsg "STAT's complete. Review STAT results in Production Reports folder."
endproc


;*****************************************************
;* Procedure Stat60
;*
;* Sends STAT commands to switch, captures return data
;* in sFile
;*
;* CALLS: Abort
;*****************************************************

proc Stat60
param string sFile, sCon
string sDate
strfmt sDate " %02d-%02d-%d" iMonth iDay iYear
strcat sFile, sDate
set dial retries 2
clear
pause 1
dial DATA sCon
while $DIALING ;Pause while dialing
yield
endwhile
set capture overwrite on
set capture query off
set capture file sFile
capture on
waitfor "Procomm Plus Ready!"
while 1
if $CARRIER
transmit "LOII"
mspause 100
transmit "^M"
waitfor "PASS?" 5 ;wait 5 seconds

if SUCCESS
… etc
 
Thx for the advice. It does work fine when, as in your example, I pass in the connection directory entry where the modem speed etc. has already been set. Unfortunately that's a less than ideal situation for me. This is being called from a VB.Net program and we want the customers (who own the modems at the other end) to be able to set and change these automatically via a web site. If we have to maintain via the Connection directory, we're always going to be involved as new customers sign up, change modems etc. I even tried setting those Connection directory modem properties via a script, but evidently you don't have that degree of control from a script (i.e. I can set area code and phone number, but not modem properties for the connectionentry from Aspect).

Still looking for a solution. You'd think this would be pretty easy!
 
Have you tried using the SET PORT commands for changing the modem settings (here's what I found in the Aspect Reference guide):

The following set/fetch statements control the communication port for the current connection.
FAILURE is set if any set port command is used to set/fetch the settings of an unopened TAPI connection. Also, all set port commands fail with the "direct connect-none" connection and .dlc connections like Telnet.
For TAPI connections, the set port commands only affect the currently selected connection in System panel of Setup. They cannot change or access settings of a connection that is referenced by a Connection Directory entry. The settings will not be saved as new settings for a TAPI connection.

All set port commands will fail if a file transfer or a dialing attempt is in progress.

port baudrate baudrate

Specifies the baud rate at which Procomm Plus talks to the current data modem. If the DEFAULT keyword is specified, the string Modem Default is used. fetch returns the current baud rate as a long value.

port databits integer

Specifies the length of a byte sent or received through the current port, either 7 or 8 bits. fetch returns 7 for 7 data bits or 8 for 8 data bits.

port dropdtr OFF | ON

Determines whether Procomm Plus will drop the RS-232 DTR signal to disconnect. fetch returns 0 for OFF or 1 for ON. This command always fails for TAPI connections.

port hardflow OFF | ON

Enables or disables hardware flow control, which is sometimes referred to as RTS/CTS flow control. fetch returns 0 for OFF or 1 for ON.

port parity NONE | ODD | EVEN | MARK | SPACE

Specifies the parity for the current communication port. fetch returns 0 for NONE, 1 for ODD, 2 for EVEN, 3 for MARK or 4 for SPACE.

port softflow OFF | ON

Enables or disables software flow control, which is sometimes referred to as XON/XOFF flow control. fetch returns 0 for OFF or 1 for ON.

port stopbits integer

Specifies the number of bits used to signify the end of a byte sent or received through the current port. fetch returns 1 for 1 stop bit or 2 for 2 stop bits.
 
OK, nevermind - I got sidetracked and forgot your first issue was that these didn't work.... Trying to multitask today, and not having any luck with it
 
No problem. I appreciate any help. Last night I tried adding a SET MODEM CONNECT "windows modem name" prior to the SET PORT commands thinking that might be what the documentation refers to as opening a TAPI connection. If also worked (FAILURE=0) but didn't help the situation. The CONNECTION DIRECTORY is the only thing that works at this point. Very frustrating.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top