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

I need a script to call a phone number 1

Status
Not open for further replies.

nasserz

Technical User
May 25, 2002
7
0
0
US
I need a script to do the following:
1- Check to see if a file exist. (File name f:\temp\eof_flag)
2- If the file do not exist, EXIT
3- If the file exist, I want the script to call a phone number 3 times:

** Call the number 3 times in a row
** Pauses for 5 seconds


** Send a tone (any tone)
** Pauses for 2 seconds

** Send a tone (any tone)
** Pauses for 2 seconds

** Send a tone (any tone)
** Pauses for 2 seconds

** EXIT

I am thinking of somthing similar to:
ATDT 15551212,,,,,,1111,,1111,,1111,1111

I appreciate your help!
 
Hello,

This is something I threw together. It checks if a File Exits, and Exits if File Not Found. Then it Dials a Server and Waits for the Login Prompt. It then Disconnects and Repeats the Process. I'm not sure how you can Transmit a Tone; but maybe this will get you going in the Right Direction.

proc main
string DialNum = "9-1-888-777-6620" ;* Number.
string sDisc = "Disconnecting"
integer Count

CheckFile()

for Count = 0 upto 4
dialnumber DATA DialNum ; Dial Number.
clear
waitfor "Red Hat"
pause 20
;* Send Tone Goes Here !!
pause 5
Count++
clear
Termwrites sDisc
disconnect
endfor
endproc

proc CheckFile
if not isfile "C:\Files\TestFile.xls"
errormsg "File NOT Found"
exit
endif
endproc

Let me know how you would send a TONE if you figure it out... One thing you might consider is, Recording a WAV File that consists of a Tone.

Hank
 
Hello,

I modified the Above Script to Give you a Couple of More Ideas.

proc main
string DialNum = "9-1-999-376-6620" ;* Number.
string sDisc = "Disconnecting"
string sConn = "Connected"
integer Count

CheckFile()

for Count = 0 upto 2
clear
dialnumber DATA DialNum ; Dial Number.
waitfor "Red Hat"
pause 15
if $Carrier
usermsg sConn
;* Send Tone Here ( Transmit ?? )
pause 15
endif
Count++
clear
Termwrites sDisc
pause 5
disconnect
endfor
endproc

proc CheckFile
if not isfile "C:\Files\TestFile.xls"
errormsg "File NOT Found"
exit
endif
endproc
 
I think Hank's script takes care of all your issues, except for the tone. You are on the right track with ATDT 15551212,,,,,,1111,,1111,,1111,1111, however you would only need to send one 1 instead of four, unless the device you are calling is looking for a tone of a certain length. If you use the ATDT command, your script will need to use the commandmode on menu item to be able to send the ATDT command to the modem. The easiest method would be to put the entire phone number, including commas and ones, in the Connection Directory and dial that number instead of using the ATDT command directly.
 
Jank & Knob,

Thanks for your help. I took your script and modified it to send the tone. The catch is there is no assurance that the phone is going to be picked-up. Here is the script:

==========================================================

proc main
string DialNum = "1-443-555-1212,,,T11,22,33,44,55,66,77,88,123456789,1111,2222,3333,4444,5555,6666,7777,8888,1232456789"
integer nbr=1


string ThisDate
string ThisTime
string ErrMsg

ErrMsg = "EOD Did not complete within the specified time. Please re-run script! This message was generated on "

while nbr = 1


if isfile "C:\temp\eod_begin"
pause 3600 ;* Pause for 3600 seconds (one hour). Wait for the End-of-Day flag to show up.
if not isfile "C:\temp\eod_end"
;*****************
dialnumber DATA DialNum ; Dial Number.
pause 5
;*
disconnect
;*
ThisDate = $date
ThisTime = $time24
strcat ThisDate " at "
strcat ThisDate ThisTime
strcat ErrMsg ThisDate
errormsg ErrMsg
exit
;*
endif
;*
endif

pause 300 ;* Sleep for 5 minutes

endwhile

endproc
 

Thanks for your help. I took your script and modified it to send the tone. The catch is there is no assurance that the phone is going to be picked-up. Here is the script:

==========================================================

proc main
string DialNum = "1-443-555-1212,,,T11,22,33,44,55,66,77,88,123456789,1111,2222,3333,4444,5555,6666,7777,8888,1232456789"
integer nbr=1


string ThisDate
string ThisTime
string ErrMsg

ErrMsg = "EOD Did not complete within the specified time. Please re-run script! This message was generated on "

while nbr = 1


if isfile "C:\temp\eod_begin"
pause 3600 ;* Pause for 3600 seconds (one hour). Wait for the End-of-Day flag to show up.
if not isfile "C:\temp\eod_end"
;*****************
dialnumber DATA DialNum ; Dial Number.
pause 5
;*
disconnect
;*
ThisDate = $date
ThisTime = $time24
strcat ThisDate " at "
strcat ThisDate ThisTime
strcat ErrMsg ThisDate
errormsg ErrMsg
exit
;*
endif
;*
endif

pause 300 ;* Sleep for 5 minutes

endwhile

endproc
 
Unfortunately, voice operations is not something that Procomm was designed for, so there is no real workaround for the problem you've noted (assuming you are dialing a voice number and not a pager or other similar device).
 
Here's my problem,

I have an Data entry in my Connection Directory named "GPS" that I would like to execute via my script.

I would like to specify within the ASPECT script that I want a date stamped TXT capture file. Per this thread I have added the following lines at the very tippy-top of my script:

string FileName
integer iDay, iMonth, iYear, iHour, iMin, iSec
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt FileName "%02d%02d%2d" iMonth iDay iYear
strcat FileName ".TXT"
termwrites FileName
termwrites "`n`r" ;* Should See MMDDYYYY.txt

I would like this date stamped TXT output file to be put on a drive that is mapped (ie F:\FMACDATA\GPS\LOGS\).

How might one go about this?

Best,
Matt
 
Hello,

Here's something to Play Around With.

Proc main
string sDrive = "F"
string sDirectory = "\FMACDATA\GPS\LOGS"
string sOutFile
string sFileSpec
string sExt = "txt"
integer szMonth, szDay, szYear, szHour, szMin, szSec
ltimeints $LTIME szMonth szDay szYear szHour szMin szSec
strfmt sOutFile "%02d%02d%d" szMonth szDay szYear
makepath sFileSpec sDrive sDirectory sOutFile sExt
Termwrites sFileSpec
Termwrites "`r`n"
Endproc

Hank
 
Hello Again,

Sorry I had the LTIMEINT Variables in the Incorrect Order.

Proc main
string sDrive = "F"
string sDirectory = "\FMACDATA\GPS\LOGS"
string sOutFile
string sFileSpec
string sExt = "txt"
integer szMonth, szDay, szYear, szHour, szMin, szSec
ltimeints $LTIME szYear szMonth szDay szHour szMin szSec
strfmt sOutFile "%02d%02d%d" szMonth szDay szYear
makepath sFileSpec sDrive sDirectory sOutFile sExt
Termwrites sFileSpec
Termwrites "`r`n"
Endproc

Hank
 
I wanted to add one Last Entry to your Question. On the Capture Issue, You Make want to Use Something Like This.

Proc main
string sPath = "F:\FMACDATA\GPS\LOGS"
string sOutFile
integer szMonth, szDay, szYear, szHour, szMin, szSec
ltimeints $LTIME szYear szMonth szDay szHour szMin szSec
strfmt sCapFile "%02d%02d%d" szMonth szDay szYear
set capture path sPath
set capture file sCapFile

Capture on

Capture off

Endproc

Hank
 
Brain Death Set IN:

strfmt sCapFile "%02d%02d%d.txt" szMonth szDay szYear

Hank
 
Hank et al.,

I will let you know about the file capture when I get down to the lower level and login to the box.

I still have a Data entry in my Connection Directory named "GPS" that I would like to execute via my script. Do I use the DIALENTRY Set/Fetch statements?
ex

FETCH DIALENTRY PHONENUMBER "GPS"

Will this get the whole entry and then dial? I'm looking at the Dialentry Set/Fetch sheet and I wish they showed some usage.

Best,
Matt
 
Hank,
The output file was written in Date format and stored on the mapped drive of my choosing. (Sittin fat and happy...well almost)

I still would like to know the answer to my above question on dailing an entry that is in my connection directory.

Thanks so much...a star for your wonderful help!

Best,
Matt
 
Forgot one thing...

What command do I execute after I dial outbound and tell the program to wait until the connection is made before continuing running the script?

-Me
 
Matt,

I don't Normally use the Connection Directory; but I played around and came up with this. You'll have to Refine it especially the Disconnect Part.

Proc Main
dialload "C:\Procomm\EMAIL.dir"
if success
usermsg "success"
else
usermsg "failure"
endif
dial DATA "EMAIL"
while $DIALING
Yield
endwhile
;
;
; CODE FOR CONNECTION
;
;
pause 5 ;* Pause 5 Seconds
disconnect
Endproc

Hank
 
Hank et. Al,

You and I must be using a different version as I didn't get things working. I do have a PW4.dir that has been modified very recently but no EMAIL.dir. All the other dir files haven't been touched since 97. (wow!)

I was guessing from your post that EMAIL.dir is the connection directory storing your DATA entry named EMAIL? I tried the following:


dialload "C:\Progam Files\Procomm Plus\PW4.dir"
dial DATA "GPS" ;the name of my entry is GPS
while $Dialing
Yield
endwhile


I really don't even have to use the connection directory but I thought it'd be an easy task. I just need to dial (as DATA) 703XXXXXXX. I'm not sure b/c the computer isn't in front of me but it may require a 9 and a short pause. Is it easier to do this with the connection directory or just dailing straight? Would I use:


string DialNum = "9703XXXXXXX"
dialnumber DATA DialNum



Thanks in Advance
Matt
 
Matt,

The EMAIL.dir was created when I added an EMAIL Connection in the Data Directory.

You can also do it with your Example as well.

Hank camphm@bellsouth.net
 
Hank,

I really wanted to thank you for guiding me through this thread by helping with issues that arose when I was writing the bank polling script.

You've been very helpful.

Best,
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top