Jump to content

Recommended Posts

Posted (edited)

I've been putting together a few scraps here and there the past couple nights.

Fone is a telephone tool with Cdyne calls, a dtmf dialpad with special tones and presets, and a text-to-speech talker with presets

Posted Image

Posted Image

Posted Image

This script requires Media.au3

The dtmf tones can be downloaded here

They should be in a subdirectory called "Tones"

Script can be downloaded here

Compiled Zip here

#include <GUIConstants.au3>
#include <INet.au3>
#include <media.au3>
$FONE = GUICreate("FONE", 324, 432, 185, 147)
$Tab1 = GUICtrlCreateTab(8, 8, 305, 417)
$TabSheet1 = GUICtrlCreateTabItem("Cdyne")
$AboutCdyne = GUICtrlCreateGroup("About Cdyne", 16, 40, 281, 65)
GUICtrlCreateLabel("This Method will call any phone number in the US/Canada and read the TextToSay to that phone number.", 24, 56, 264, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Make a call", 16, 112, 281, 233)
$numberto = GUICtrlCreateInput("", 136, 128, 153, 21, -1, $WS_EX_CLIENTEDGE)
$numberfrom = GUICtrlCreateInput("", 136, 152, 153, 21, -1, $WS_EX_CLIENTEDGE)
$fromname= GUICtrlCreateInput("FONE", 136, 176, 153, 21, -1, $WS_EX_CLIENTEDGE)
$voicecom = GUICtrlCreateCombo("William", 136, 200, 153, 21)
GUICtrlSetData($voicecom, "William|Emily|Frank|Lawrence|Millie|Isabelle|Katrin|Marta|Vittoria")
$lkey = GUICtrlCreateInput("0", 136, 224, 153, 21, -1, $WS_EX_CLIENTEDGE)
$say = GUICtrlCreateEdit("", 24, 256, 265, 57, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetData($say, "Type your message here.")
GUICtrlCreateLabel("Dial Number", 24, 132, 62, 17)
GUICtrlCreateLabel("Caller Id Number", 24, 156, 82, 17)
GUICtrlCreateLabel("Caller Id Name", 24, 180, 73, 17)
GUICtrlCreateLabel("Speaking Voice", 24, 202, 79, 17)
GUICtrlCreateLabel("Cdyne License Key", 24, 228, 95, 17)
$Send = GUICtrlCreateButton("Send", 240, 320, 50, 20)
$Group2 = GUICtrlCreateGroup("Call Status", 16, 352, 281, 65)
GUICtrlCreateLabel("Last Call Status", 24, 392, 77, 17)
GUICtrlCreateLabel("Last Call Id", 24, 372, 56, 17)
$queueid = GUICtrlCreateLabel("0", 104, 372, 125, 17, $SS_SUNKEN)
$status = GUICtrlCreateLabel("No Call Sent", 104, 392, 125, 17, $SS_SUNKEN)
$refresh = GUICtrlCreateButton("Refresh", 240, 392, 50, 20)
$TabSheet2 = GUICtrlCreateTabItem("Dialpad")
$Group3 = GUICtrlCreateGroup("Tone Autodialer", 16, 40, 281, 217)
$tone_num1 = GUICtrlCreateInput("", 24, 64, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num2 = GUICtrlCreateInput("", 24, 88, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num3 = GUICtrlCreateInput("", 24, 112, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num4 = GUICtrlCreateInput("", 24, 136, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num5 = GUICtrlCreateInput("", 24, 160, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num6 = GUICtrlCreateInput("", 24, 184, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num7 = GUICtrlCreateInput("", 24, 208, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_num8 = GUICtrlCreateInput("", 24, 232, 217, 21, -1, $WS_EX_CLIENTEDGE)
$tone_dial1 = GUICtrlCreateButton("Dial", 248, 64, 40, 20)
$tone_dial2 = GUICtrlCreateButton("Dial", 248, 88, 40, 20)
$tone_dial3 = GUICtrlCreateButton("Dial", 248, 112, 40, 20)
$tone_dial4 = GUICtrlCreateButton("Dial", 248, 136, 40, 20)
$tone_dial5 = GUICtrlCreateButton("Dial", 248, 160, 40, 20)
$tone_dial6 = GUICtrlCreateButton("Dial", 248, 184, 40, 20)
$tone_dial7 = GUICtrlCreateButton("Dial", 248, 208, 40, 20)
$tone_dial8 = GUICtrlCreateButton("Dial", 248, 232, 40, 20)
$Group4 = GUICtrlCreateGroup("DialPad", 16, 272, 281, 145)
$tone1 = GUICtrlCreateButton("1", 32, 288, 50, 25)
$tone2 = GUICtrlCreateButton("2", 96, 288, 50, 25)
$tone3 = GUICtrlCreateButton("3", 160, 288, 50, 25)
$tone4 = GUICtrlCreateButton("4", 32, 320, 50, 25)
$tone5 = GUICtrlCreateButton("5", 96, 320, 50, 25)
$tone6 = GUICtrlCreateButton("6", 160, 320, 50, 25)
$tone7 = GUICtrlCreateButton("7", 32, 352, 50, 25)
$tone8 = GUICtrlCreateButton("8", 96, 352, 50, 25)
$tone9 = GUICtrlCreateButton("9", 160, 352, 50, 25)
$tonehash = GUICtrlCreateButton("#", 32, 384, 50, 25)
$tone0 = GUICtrlCreateButton("0", 96, 384, 50, 25)
$tonestar = GUICtrlCreateButton("*", 160, 384, 50, 25)
$toneA = GUICtrlCreateButton("A", 224, 288, 50, 25)
$toneB = GUICtrlCreateButton("B", 224, 320, 50, 25)
$toneC = GUICtrlCreateButton("C", 224, 352, 50, 25)
$toneD = GUICtrlCreateButton("D", 224, 384, 50, 25)
$TabSheet3 = GUICtrlCreateTabItem("Talker")
$Group5 = GUICtrlCreateGroup("Talker Options", 16, 288, 289, 129)
$myspeed = GUICtrlCreateSlider(88, 384, 214, 21, $TBS_NOTICKS)
GUICtrlSetLimit($myspeed,10,-10)
$mypitch = GUICtrlCreateSlider(88, 360, 214, 21, $TBS_NOTICKS)
GUICtrlSetLimit($mypitch,5,-5)
$myvolume = GUICtrlCreateSlider(88, 336, 214, 21, $TBS_NOTICKS)
GUICtrlSetLimit($myvolume,100,0)
GUICtrlSetData($myvolume,100)
$femaleVoice = GUICtrlCreateRadio("Female", 96, 312, 65, 17)
$maleVoice = GUICtrlCreateRadio("Male", 160, 312, 65, 17)
$oldVoice = GUICtrlCreateRadio("Elderly", 225, 312, 65, 17)
GUICtrlSetState ($femaleVoice,$GUI_CHECKED)

GUICtrlCreateLabel("Talker Voice", 24, 312, 64, 17)
GUICtrlCreateLabel("Talk Volume", 24, 336, 59, 17)
GUICtrlCreateLabel("Talk Pitch", 24, 360, 52, 17)
GUICtrlCreateLabel("Talk Speed", 24, 384, 63, 17)

$Group6 = GUICtrlCreateGroup("Text Talker", 16, 40, 289, 241)
$say1 = GUICtrlCreateInput("", 24, 56, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say2 = GUICtrlCreateInput("", 24, 80, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say3 = GUICtrlCreateInput("", 24, 104, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say4 = GUICtrlCreateInput("", 24, 128, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say5 = GUICtrlCreateInput("", 24, 152, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say6 = GUICtrlCreateInput("", 24, 176, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say7 = GUICtrlCreateInput("", 24, 200, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say8 = GUICtrlCreateInput("", 24, 224, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say9 = GUICtrlCreateInput("", 24, 248, 233, 21, -1, $WS_EX_CLIENTEDGE)
$say_but1 = GUICtrlCreateButton("Say", 264, 56, 35, 20)
$say_but2 = GUICtrlCreateButton("Say", 264, 80, 35, 20)
$say_but3 = GUICtrlCreateButton("Say", 264, 104, 35, 20)
$say_but4 = GUICtrlCreateButton("Say", 264, 128, 35, 20)
$say_but5 = GUICtrlCreateButton("Say", 264, 152, 35, 20)
$say_but6 = GUICtrlCreateButton("Say", 264, 176, 35, 20)
$say_but7 = GUICtrlCreateButton("Say", 264, 200, 35, 20)
$say_but8 = GUICtrlCreateButton("Say", 264, 224, 35, 20)
$say_but9 = GUICtrlCreateButton("Say", 264, 248, 35, 20)
Global $voice=1
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Send
        GUICtrlSetData($status, "Attempting Call")
        $voicearray = StringSplit("David|William|Emily|Frank|Lawrence|Millie|Isabelle|Katrin|Marta|Vittoria", "|")
        $voice = GUICtrlRead ( $voicecom )
        For $i = 1 To $voicearray[0]
            ProgressSet( $i*10 )
            If $voice = $voicearray[$i] Then $voice = $i
        Next
        GUICtrlSetData($status, "Sending Request" )
        $call = _Inetgetsource( "ws.cdyne.com/NotifyWS/phonenotify.asmx/NotifyPhoneBasic?PhoneNumberToDial=" & GUICtrlRead( $numberto ) & "&TextToSay=" & GUICtrlRead( $say ) & "&CallerID=" & GUICtrlRead( $numberfrom ) & "&CallerIDname=" & GUICtrlRead( $fromname ) & "&VoiceID=" & $voice & "&LicenseKey=" & GUICtrlRead( $lkey ) )
        Sleep(2000)
        GUICtrlSetData($status, "Send Complete" )
        GUICtrlSetData($queueid, _StringBetween($call, "<QueueID>", "</QueueID>"))
        _CallStatus(GUICtrlRead ( $queueid))
    Case $msg = $refresh
        _CallStatus(GUICtrlRead ( $queueid))
    Case $msg=$femaleVoice
            $voice=1
    Case $msg=$maleVoice
            $voice=2
    Case $msg=$oldVoice
            $voice=3
    Case $msg = $tone1
        dtmf('1')
    Case $msg = $tone2
        dtmf('2')
    Case $msg = $tone3
        dtmf('3')
    Case $msg = $tone4
        dtmf('4')
    Case $msg = $tone5
        dtmf('5')
    Case $msg = $tone6
        dtmf('6')
    Case $msg = $tone7
        dtmf('7')
    Case $msg = $tone8
        dtmf('8')
    Case $msg = $tone9
        dtmf('9')
    Case $msg = $tone0
        dtmf('0')
    Case $msg = $tonehash
        dtmf('hash')
    Case $msg = $tonestar
        dtmf('star')
    Case $msg = $toneA
        dtmf('A')
    Case $msg = $toneB
        dtmf('B')
    Case $msg = $toneC
        dtmf('C')
    Case $msg = $toneD
        dtmf('D')
    Case $msg = $say_but1
        mouthoff($say1)
    Case $msg = $say_but2
        mouthoff($say2)
    Case $msg = $say_but3
        mouthoff($say3)
    Case $msg = $say_but4
        mouthoff($say4)
    Case $msg = $say_but5
        mouthoff($say5)
    Case $msg = $say_but6
        mouthoff($say6)
    Case $msg = $say_but7
        mouthoff($say7)
    Case $msg = $say_but8
        mouthoff($say8)
    Case $msg = $say_but9
        mouthoff($say9)
    Case $msg = $tone_dial1
        autodial_tones($tone_num1)
    Case $msg = $tone_dial2
        autodial_tones($tone_num2)
    Case $msg = $tone_dial3
        autodial_tones($tone_num3)
    Case $msg = $tone_dial4
        autodial_tones($tone_num4)
    Case $msg = $tone_dial5
        autodial_tones($tone_num5)
    Case $msg = $tone_dial6
        autodial_tones($tone_num6)
    Case $msg = $tone_dial7
        autodial_tones($tone_num7)
    Case $msg = $tone_dial8
        autodial_tones($tone_num8)
        
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func _StringBetween($string, $begin, $end)
    Local $_begin, $_end
    $_begin = StringSplit($string, $begin, 1)
    $_end = StringSplit($_begin[2], $end, 1)
    If Not @error Then
        Return ($_end[1])
    EndIf
EndFunc

Func _CallStatus($id)
    $st = _Inetgetsource( "http://ws.cdyne.com/NotifyWS/phonenotify.asmx/GetQueueIDStatus?QueueID=" & $id)
    GUICtrlSetData($status, _StringBetween($st, "<ResponseText>", "</ResponseText>"))
EndFunc

Func _TalkOBJ($text,$voice,$speed,$pitch,$volume)
Local $quite = 0
   Local $o_speech=ObjCreate("SAPI.SpVoice")
    Select
        Case $voice==0
            Return
        Case $voice==1
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0)
        Case $voice==2
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0)
        Case $voice==3
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
    EndSelect
    $text=StringReplace($text, "<e>", "<emph>")
    $text=StringReplace($text, "</e>", "</emph>")
    $text=StringReplace($text, "  ", "<silence msec='100'/>")
    $o_speech.Speak("<pitch absmiddle='"&$pitch&"'><rate speed='"&$speed&"'><volume level='"&$volume&"'>"&$text&"</volume></rate></pitch>")
    $o_speech = ""
EndFunc

Func mouthoff($myedit)
    $text=GUICtrlRead($myedit)
    $speed=GUICtrlRead($myspeed)
    $pitch=GUICtrlRead($mypitch)
    $volume=GUICtrlRead($myvolume)
    _TalkOBJ($text,$voice,$speed,$pitch,$volume)
EndFunc

Func dtmf($t)
    $tone = _MediaOpen("Tones/"& $t & ".wav")
    _MediaPlay($tone)
    sleep(150)
    _MediaClose($tone)
EndFunc

Func autodial_tones($ob)
    $text=GUICtrlRead($ob)
    $numbers = StringSplit ($text, "")
    $i = 1
    While $i <= $numbers[0]
        dtmf($numbers[$i])
        $i = $i + 1
    WEnd
EndFunc
Edited by Emerica
  • Moderators
Posted

Nice, see you took zerocools idea a step further :D :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

That looks cool, I haven't tried it yet but, So you can talk with TTS through the phone line after dialing the number??

nice job too

BTW You might want to change the gui to appear in the middle of the screen

Edited by zerocool60544
Check out ConsultingJoe.com
Posted (edited)

yeah, it would be good to change the gui to appear in the middle,

my monitors at 1280x1024 and i can't see it

btw: where can i get media.au3?

this is still really impressive work! (well, at least it's better than anything i can do :D)

Edited by The Great 'Awesoma-Powa!'
Posted

yeah, it would be good to change the gui to appear in the middle,

my monitors at 1280x1024 and i can't see it

btw: where can i get media.au3?

this is still really impressive work! (well, at least it's better than anything i can do :D)

Don't doubt yourself. A night or two with Koda form designer and Scite and you can make some pretty nice stuff quickly. Most of the actuall ideas where posted here earlier,I have just started putting them together in a single app.

I've touched up the resolution problem sligtly. I had this on a second monitor which is why is was off your screen.

Media.au3 is here in the forums somewhere

I also have a version here

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...