WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sample Code

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Phone Dialer

 Keywords: Serial pComOpen Dial Phone Numbers

;;;;  NTP-PHONE-DIALER.WBT Copyright 2011 by Garry J. Nichol (NTP)
;;;;  Dials phone numbers and opens web sites from a user created text file
;;;;
;;;;   This program uses a text file called "e:\led driver project\vendors.txt"
;;;;   There must be ONLY ONE space between the Dial and the name and between the name and the number
;;;;   There must be at least ONE space after the http site address, same with FTP site
;;;;   There must be at least ONE space after EMAIL  before the email address
;;;;
;;;;   It uses Internet Explorer as the browser in this example but any browser could be used
;;;;
;;;;   Here is an  Example VENDORS.txt file
;;;;-------------------------------------------------------------------------------
;;;;                   PHONE NUMBERS              (CLICK TO DIAL)
;;;;Dial ALLIED 18004335700
;;;;Dial 4SITE 18668590844
;;;;
;;;;                   SITE ACCESS  and FTP                 (CLICK TO OPEN)
;;;;http://www.alliedelec.com/       PARTS
;;;;http://4siteelectronics.com       KNOBS AND SWITCHES
;;;;ftp://173.160.155.216               GC upload ftp site(put username & psswd here)
;;;;
;;;;                   EMAIL ADDRESSES
;;;;EMAIL garry@ntp-led-driver.com
;;;;-------------------------------------------------------------------------------

IntControl(72, -1, 0, 0, 0)    ;;;Lets file list box return nothing
IntControl(49, 3, 0, 0, 0)     ;;; ADDS CAPTION BUTTONS TO DIALOG
AddExtender("wwser44i.dll")

DialPrefix="ATDT"
HangCommand="ATH0"

;;;I MOVED THIS DOWN INTO ACTUAL DIALER TO SOLVE ANY PROBLEMS
;;;port=pComOpen("COM3",0,57600,"8N1","RTSRTS")

:RETRY
  flagretry=0
  IntControl(63, 50, 0,378,1000)
  str1=AskFiletext("VENDOR PHONE DIALER AND SITE BROWSER  ", "e:\led driver project\vendors.txt", @UNSORTED, @SINGLE)
  TimeDelay(0.2)
  posx=StrIndex(str1, " ", 1, @FWDSCAN)
  str4=StrSub(str1, 1, 4)
;;message(str4, str1)
  str4=StrUpper(str4)
     If str4=="DIAL" Then GoSub DIAL
     If str4=="HTTP" || str4=="FTP:" Then GoSub HTTP
     If str4=="EMAI" Then GoSub EMAIL
     If str4 != "DIAL" && str4 != "HTTP"  && str4 !="FTP:" && str4 != "EMAI" Then Message("Sorry...Try again", "Please click on PHONE # to Dial, SITE to open or Email address to send to")
  Goto RETRY

:HTTP
     str1=StrSub(str1, 1, posx)
     Run("C:\Program Files\Internet Explorer\iexplore.exe", str1)
Return

:DIAL
     str2=StrSub(str1, posx + 1, -1)
     posx2=StrIndex(str2, " ", 1, @FWDSCAN)
     str2=StrSub(str2, posx2 +1, -1)
     str3=StrSub(str1, posx, posx2)
     port=pComOpen("COM3",0,57600,"8N1","RTSRTS")
     DialCommand="%DialPrefix%%str2%;"
     pModemCommand (Port, DialCommand)
     Message ("  Initializing Modem... Then Dialing %str3% %str2%", "Please wait until dialed, Pick up phone,  and then OK to exit Dialer")
     pModemCommand (Port, HangCommand )
     pComClose(port, 5)
Return

:EMAIL
   str2=StrSub(str1, posx +1, -1)
   str2=StrCat("mailto:", str2)
   ShellExecute(str2, "", "", @NORMAL, "")
Return


pModemCommand (Port, HangCommand )
pComClose(port, 1)

Article ID:   W17602
Filename:   Phone Dialer.txt
File Created: 2011:12:13:09:02:54
Last Updated: 2011:12:13:09:02:54