home *** CD-ROM | disk | FTP | other *** search
- /* dial.frx
- * Written by Eckard Haupt and Nils Bandener
- * $VER: dial.frx 6.6 (19.10.97)
- */
-
- /*
-
- Script for automatic dialing of phone numbers with a modem
- from Fiasco databases.
-
- Requirements:
-
- - Phone and modem either connected at a double connection or
- connected in series directly at the modem, so that the modem
- makes the phone off line.
-
- - A normal field or a listview field with the name "Phone" or a
- name that has been specified as argument for the script.
- The script is concieved for Zyxel 1496+ modems, however it
- should run with other modems.
-
- - Please also see the options below that may be set
-
- Usage:
-
- Select record with number to be dialed, start script, click
- on "Yes". After that the modem dials, if dialing is successful,
- lift the reciever, click on "Modem hang up", and ... talk ;-)
-
- */
-
- scriptname = "Dial"
-
- fieldname = "Phone"
-
- /*
- * dialcommand:
- *
- * Modem command to be executed for dialing.
- *
- * Use DP instead of DT if you have an analog phone connection.
- * Use DP0W or DT0W to wait for a free tone before dialing.
- */
-
- dialcommand = "DT"
-
- /*
- * dialsuffix:
- *
- * String to be appended to the dialed number
- *
- * Default: "". If you add three numbers like "111" this does not
- * affect dialing but is able to fool the connection list by the
- * German Telekom. The connection list hides the last three numbers,
- * if you set dialsuffix to "111", it will hide these three ones.
- * (Note: This method is known to be working and known to be not
- * working. You have to try it for yourself, whether it is working
- * for you)
- */
-
- dialsuffix = ""
-
- /*
- * setreg11:
- *
- * If 1, sets a modem register for faster dialing
- * Check compatibility with your modem!!
- */
-
- setreg11 = 0
-
- Options Results
-
- fiasco_port = address()
-
- Signal on Syntax
- Signal on Halt
- Signal on Break_C
- Signal on Failure
-
- LockGUI
-
- Options Results
-
- /* Open rexxsupport.library
- */
-
- if ~show('l',"rexxsupport.library") then
- do
- if ~addlib('rexxsupport.library',0,-30) then
- do
- RequestChoice '"Could not open rexxsupport.library" "Cancel"'
-
- call bail_out
- end
- end
-
- /* Is the field a listview field or a normal field? */
-
- GetAttr "Field Name" fieldname "listview var lvfield"
-
- if lvfield then
- do
- /* Field is a listview field */
-
- GetField fieldname "listentrycount var num"
-
- do i = 1 to num
-
- GetField fieldname "ListEntry" i "var n"
-
- RequestChoice '"Call the number*n' || n || ' ?" "Yes|No|Cancel" Title "Dial"'
-
- if result = 1 then
- do
- if dial(n,1) = 0 then break
- end
- else if result = 0 then break
-
- end
- end
- else
- do
- /* Field is a simple one */
-
- GetField fieldname "var n"
-
- if n ~= "" then
- do
- RequestChoice '"Call the number*n' || n || ' ?" "Yes|Cancel" Title "Dial"'
-
- if result = 1 then
- do
- call dial(n,0)
- end
- end
- end
-
- call bail_out
-
- /*
- * Function dial():
- *
- * result = dial(number, multiplenumbers)
- *
- * number - Number to be dialed
- * multiplenumbers - Display a "Next number" gadget (boolean)
- *
- * result - 0 = success
- * 1 = next number
- * 2 = system error
- */
-
- dial:
-
- number = arg(1)
-
- if open("f","SER:","WRITE") then
- do
-
- call writech("f","AT&F" || d2c(13))
-
- call delay(20)
-
- if setreg11 then
- do
- call writech("f","ATX7S11=55L7M1" || d2c(13))
- call delay(20)
- end
-
- call writech("f", "AT" || dialcommand || compress(number, "()/-") || dialsuffix || d2c(13))
-
- if arg(2) then
- do
- resps = "Modem hang up|Next number"
- end
- else
- do
- resps = "Modem hang up"
- end
-
- RequestChoice '"Dialing: ' || number || '" "' || resps || '" var ch'
-
- call writech("f","ATH" || d2c(13))
-
- call close("f")
-
- if ch = 1 then return 0
- else return 1
-
- end
- else
- do
- RequestChoice '"Could not open serial.device" "Cancel"'
-
- return 2
-
- end
-
-
- bail_out:
-
- Interpret Address fiasco_port
-
- UnlockGUI
- /* ResetStatus */
-
- exit
-
- syntax:
- failure:
-
- if show("Ports", fiasco_port) then
- do
- Interpret Address fiasco_port
-
- RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
- end
- else
- do
- say "Error" rc "in line" sigl ":" errortext(rc)
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
- halt:
- break_c:
-
- if show("Ports", fiasco_port) then
- do
- Interpret Address fiasco_port
-
- RequestChoice '"Script Abort Requested" "Abort Script|Continue Script" Title "' || scriptname || '"'
-
- if result = 0 then return
- end
- else
- do
- say "*** Break"
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
-
-
-