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!

Modem Parity & Baud Rates

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help,
I need to write a script to change the Parity and Baud rates. Depending on the Entry dialed, I need ONE of THREE scripts to Run. 2400 N-8-1, 2400 E-7-1, 19200 N-8-1.

Currently I have a login script that executes when the connection is completed. However, I need to change the Parity/Baud Rate, prior to dialing. I have about 30 different directories with the following Sub-Folders.

Example:

Mycompany (Dialing Directory)

Switch Folder; which uses 2400 E-7-1.
VoiceMail Folder; which uses 2400 N-8-1.
Buffer Folder; which uses 19200 N-8-1.

NOTE: I am running 2 different versions of ProComm Plus (4.5 and 4.8), Not sure if it makes a difference.

Any help would be gratly appreciated. Thanks in advance
 
You can use a couple set commands to do this. Here's some information copied from the help file:

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 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.

However, these commands only work if a connection has been established or if you are using modem command mode. Possibly a better solution is to edit each entry in your Connection Directory so that the correct baud rate and parity is set there. To do this, open the Connection Directory, select an entry, click on the Port Settings button in the middle of the screen, select your modem (if necessary), then click on the Modem/Connection Properties button. Change the maximum speed to the required value, then click on the Connection tab and set your parity if necessary. You should be able to set the speed and parity for each Connection Directory entry, although I have seen some people report problems doing this on the Symantec forum (I've been unable to reproduce those reports). Hopefully this will work in your particular situation.
aspect@aspectscripting.com
 
The problem I have is that I am not the only user using this script. Everyone does not have the same modems that I do. Alot of people i my office ate technologically challanged, if you know what I mean. Therefore I am looking for a way to automate this process, in oreder to avoid repeat questions and calls.
 
Unfortunately, it doesn't look like you can write a script that goes through each entry in the Connection Directory and set the baud rate and parity, so you'll have to use a script to change those values. I played with this a little tonight, but the system I connected to didn't like when I changed the baud rate and parity after making the connection. You might want to investigate using modem command mode (using the commandmode on command), setting the baud rate and parity, and then manually sending the necessary AT commands to the modem. I think this would work best if everyone has different modems and you can't modify their Connection Directory entries manually.
aspect@aspectscripting.com
 
KNOB,

Just thought of this. I created a script file to run prior to connection. I can change the the Script file to Run prior to connection. the Batch file would something like this:

Com19005.bat (BATCH FILE NAME)

mode com1: baud=24 parity=e data=7 stop=1

Com29005.bat (BATCH FILE NAME)

mode com1: baud=24 parity=e data=7 stop=1



ProComm Script File
E_7_1_2400.was

Proc main
string CmdLine
integer x
integer y
strfmt CmdLine "C:\Program Files\Procomm plus\aspect\Com19005.bat"
run CmdLine x
strfmt CmdLine "C:\Program Files\Procomm plus\aspect\Com29005.bat"
run CmdLine y
endproc

However, when I run this script file the Entry in the Connection Direction will not dial. Therefore I cannot tell if the Batch File works. Your assistance in this will really be appreciated.
 
I tried something similar last night (basically trying to run a script before dialing that use the set port baudrate and set port parity commands), but ran into the same problem that you did with the dial operation not occurring. I'll try to work on this on my home machine tonight (no modem at work) and see what I can figure out, but I don't think we'll have much luck with the batch file approach either.
aspect@aspectscripting.com
 
KNOB,

I was thinking that if the Batch file works from within the script then there should be some command in procomm to dial the entry selected. Howefver ensuring that the Entry is selected and has the focus..ah there is the problem. I tried just using the batch file alone and it executed fine. When i tried to dial into on the the ROLM switches I have that uses 2400 E-7-1, it showed connected at 115000, but worked fine. i think that it may be chaning the Baud rate, parity and stopbits, just not updating the Programs (ie. Windows Control Panel, and ProComm). Of course this is all supposition on my part.
 
I think the main problem with the batch file is that it may set the com port to your desired parameters, but when Procomm dials your connection, it will use whatever is defined as the defaults for that modem (unless you set the parameters for that particular Connection Directory entry). What would be interesting to try is to see if your batch file worked OK with the HyperTerminal program shipped with Windows. If it did not, then we would know this is a Windows/TAPI limitation since HyperTerminal and Procomm both use TAPI to communicate with the modem (unless you use data command mode in Procomm).
aspect@aspectscripting.com
 
Well,

I tried with HyperTerminal and still, NO GO. Here is something I have been working on.

string szAllProt = "Zmodem,Kermit,Xmodem,1K-Xmodem,1K-Xmodem-G,Ymodem,Ymodem-G,CIS-B+,ASCII,RAW ASCII,IND$FILE"
string szAllConn = "direct connect-Com1,direct connect-Com2,direct connect-Com3,direct connect-Com4"
string szAllSpeed = "1200"
string szCurTerm, szCurConn
string szDefTerm, szDefConn
integer iQSelect, iCurDBits, iCurParity, ICurSbits, iDefSBits, iDefDBits
integer iDefParity
long lCurSpeed, lAllSpeed

proc Main
string MyEntry
string CmdLine
integer x, y

strfmt CmdLine "C:\Program Files\Procomm plus\aspect\Com19005.bat"
run CmdLine x
strfmt CmdLine "C:\Program Files\Procomm plus\aspect\Com29005.bat"
run CmdLine y

fetch quickselect iQSelect ;Find out if QuickSelect is on or not.
if iQselect == 0 ;If not,
set quickselect 1 ;turn it on while script is running.
usermsg "Turning on Quickselect Line while this script runs"
endif

fetch terminal type szCurTerm ;Fetch current terminal type.
szDefTerm = "IBM3101"
szDefTerm = szCurTerm ;Assign value to temporary variable.
set terminal type szDefTerm

fetch modem connection szCurConn ;Fetch current connection type.
szDefConn = "10"
szDefConn = szCurConn ;Assign value to temporary variable.
set modem connection szDefConn ;"Sportster 14400 Fax"

fetch port baudrate lCurSpeed ;Fetch current baud rate.
atol szAllSpeed lAllSpeed
Set port baudrate lAllSpeed

fetch port databits iCurDBits ;Fetch current Databits setting.
iCurDBits = iDefDBits = 7
set port databits 7

fetch port stopbits iCurSBits ;Fetch current Stopbits setting.
iCurSBits = iDefSBits = 1
set port stopbits 1

fetch port parity iCurParity ;Fetch the current Parity setting.
iCurParity = iDefParity = 3
set port parity 3

MyEntry = $DIALENTRY
dial DATA $DIALENTRY
while $DIALING ; Loop while dialing.
endwhile
if $CARRIER ; See if we're connected.
execute "Log 9751.wax"
else
errormsg "Sorry, not connected."
endif

endProc

the batch Files are as follows:

Com19005.bat
mode com1: baud=24 parity=e data=7 stop=1

Com29005.bat
mode com1: baud=24 parity=e data=7 stop=1

and Guess what? Still no Luck. I agree this may be a is a Windows/TAPI limitation. So I guess now i will need to look into the Data Command Mode in ProComm. All this for so small a change??

 
Well,

I’m not sure that this is the easiest or best way to make the changes, but here is what I came up with. This is based on TWO Assumptions:

Assumption 1; All MODEMS will be listed BEFORE the DIRECT CONNECTIONS.
Assumption 2; There are only 2 Active Modems on the system

The Following Script sets my Modem’s to 2400 Baud, 7-EVEN-1. I wrote 2 other Scripts for 2400 Baud N-8-1, and 19200 Baud N-8-1.

Code:
proc main

   winactivate $PWMAINWIN  ; Make sure ProComm Plus has focus.
   sendkey ALT 'O'         ; Send ALT-O to open Options Menu.
   mspause 250             ; Pause to wait for menu.
   sendkey 'Y'             ; Send an 'Y' to move to System Options.
   mspause 250             ; Pause to wait for menu.
   sendkey ALT 'C'         ; Send ALT-C to select Modem Connection.
   mspause 250             ; Pause to wait for menu.
   sendkey ALT 'M'         ; Send ALT-M to move to Current Modem Connection.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x24           ; Send the Home Key to Move to Top of List
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x28           ; Send the DOWN Arrow to move Down to the 2nd Modem.
   mspause 250             ; Pause to wait for menu.

   call SetupModem
   sendkey ALT 'M'         ; Send ALT-M to move to Current Modem Connection.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x24           ; Send the Home Key to Move to Top of List
   mspause 250             ; Pause to wait for menu.

   call SetupModem
   sendvkey 0x0D           ; Send Enter Key to ACCEPT CHANGES.
   pause 2                 ; Pause to wait for menu.


endproc   

proc SetupModem   
   
   sendkey ALT 'P'         ; Send ALT-P to move to Modem Connection Properties.
   mspause 250             ; Pause to wait for menu.
   sendkey ALT 'M'         ; Send ALT-M to move to Maximum Speed.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x24           ; Send the Home Key to Move to Top of List
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x28           ; Send the DOWN Arrow to move Down to 300 baud.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x28           ; Send the DOWN Arrow to move Down to 1200 baud
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x28           ; Send the DOWN Arrow to move Down to 2400 baud.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x09           ; Send TAB Key to OK Button.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x09           ; Send TAB Key to CANCEL: Button.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x09           ; Send TAB Key to General Tab.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x27           ; Send the Right Arrow to move to the Connection Tab.
   mspause 250             ; Pause to wait for menu.
   sendkey ALT 'D'         ; Send ALT-D to move to the Data Bits field.
   mspause 250             ; Pause to wait for menu.
   sendkey '7'             ; Send an '7' to change Data Bits to 7.
   mspause 250             ; Pause to wait for menu.
   sendkey ALT 'P'         ; Send ALT-P to move to the Parity field.
   mspause 250             ; Pause to wait for menu.
   sendkey 'E'             ; Send an 'E' to change Parity to EVEN.
   mspause 250             ; Pause to wait for menu.
   sendvkey 0x0D           ; Send Enter Key to ACCEPT CHANGES.
   mspause 250             ; Pause to wait for menu.

Endproc

I hope this may be of some use to someone. I appreciate all the Help you have provided in getting me this Far.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top