找回密码
 加入
搜索
查看: 5554|回复: 4

[AU3基础] 《已解决》综合写了个 网吧呼叫点餐的 语音呼叫有问题 如下

[复制链接]
发表于 2014-12-12 15:25:05 | 显示全部楼层 |阅读模式
本帖最后由 mshuking 于 2015-4-22 15:13 编辑

已经搞好  哈哈
在此先感谢  以下两人的呼叫代码
viplight(UID: 7648449)  http://www.autoitx.com/viewthrea ... hlight=%CD%F8%B9%DC
yingf20(UID: 7653212)  http://www.autoitx.com/forum.php?mod=viewthread&tid=32614&extra=&page=1
谢谢viplight   谢谢yingf20               等此问题解决了 将服务端 客户端 免费发送。。。。

43 44 两行如何写
51-94 语音才能生效
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#Include <Date.au3>
$Form1 = GUICreate("点餐语音服务端", 460, 444)
$ListView1 = GUICtrlCreateListView("计算机|IP地址|时间|信息", 0, 0, 458, 414)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100);调整宽度
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100);调整宽度
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100);调整宽度
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 100);调整宽度
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES);设置表格边框
GUICtrlSetCursor(-1, 0);鼠标指针
$List = GUICtrlCreateContextMenu($ListView1)
$Cls = GUICtrlCreateMenuItem("清空数据", $List)
GUICtrlCreateMenuItem("", $List)
$Quit = GUICtrlCreateMenuItem("退出", $List)
GUISetState(@SW_SHOW)
TCPStartup(); 开始 TCP 服务
$ip = IniRead(@ScriptDir & '\configs.ini', 'Config', 'ServerIP', '192.168.0.7');从配置文件中读取IP
$port = IniRead(@ScriptDir & '\configs.ini', 'Config', 'ServerPort', '21991');从配置文件中读取端口
$tcpMainListen = TCPListen($ip, $port, 100);创建监听,用于接收数据
If $tcpMainListen = -1 Then
MsgBox(4096, '错误', '创建监听失败!')
Exit
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
        Case $GUI_EVENT_CLOSE,$Quit
                Exit
    Case $Cls
          GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
EndSwitch
$tcpSocket = TCPAccept($tcpMainListen);接收客户端连接
If $tcpSocket <> -1 Then;客户端连接成功
  While 1
   $TcpRecvData = TCPRecv($tcpSocket, 2048, 1);接收客户端发送的数据
   If @error Then ExitLoop ;如果接收信息出现错误,则退出循环.
   If $TcpRecvData <> '' Then
    $TcpRecvData = GUICtrlCreateListViewItem(BinaryToString($TcpRecvData, 4), $ListView1);将信息写入到$listview1控件
;这里如何写 下面语音才生效
        _PLAYJH($Jihao)
    ExitLoop
   EndIf
  WEnd
EndIf
WEnd
;=============================================================================
;语音叫号
Func _PLAYJH($Jihao)
        $JihaoHQ = StringRight($Jihao,3)
        $FenGe = StringSplit($JihaoHQ,"")
        SoundPlay("woman\fw.wav")
        Sleep(2000)
        If $Jihao < 1000 And $Jihao > 99 Then
                SoundPlay("woman"&$FenGe[1]&".wav")
                Sleep(500)
                SoundPlay("woman\100.wav")
                If $FenGe[2] <> 0 Then
                        Sleep(500)
                        SoundPlay("woman"&$FenGe[2]&".wav")
                        Sleep(500)
                        SoundPlay("woman\10.wav")        
                ElseIf $FenGe[2] = 0 And $FenGe[3] <> 0 Then
                        Sleep(500)
                        SoundPlay("woman"&$FenGe[2]&".wav")
                EndIf
                If $FenGe[3] <> 0 Then
                        Sleep(500)
                        SoundPlay("woman"&$FenGe[3]&".wav")
                EndIf
        EndIf
        If $Jihao < 100 And $Jihao > 9 Then
                $JihaoHQ = StringRight($strepl,2)
                $FenGe = StringSplit($JihaoHQ,"")
                SoundPlay("woman"&$FenGe[1]&".wav")
                Sleep(500)
                SoundPlay("woman\10.wav")
                If $FenGe[2] <> 0 Then
                        Sleep(500)
                        SoundPlay("woman"&$FenGe[2]&".wav")
                EndIf
        EndIf
        If $Jihao < 10 And $Jihao > 0 Then
                $JihaoHQ = StringRight($strepl,1)
                SoundPlay("woman"&$JihaoHQ&".wav")
        EndIf
        Sleep(500)
        SoundPlay("woman\hao.wav")
        Sleep(500)
        SoundPlay("woman\dc.wav")
EndFunc
  If $TcpRecvData <> '' Then
        ;===你需要的代码如下=========================================================================
                 $TcpRecvData = BinaryToString($TcpRecvData, 4)
                 ;$strepl=StringRegExpReplace($TcpRecvData, "[^\d]", 0)
                 $strepl=StringRegExpReplace($TcpRecvData, "[^\d]", 0)
         ;$strepl = StringSplit(BinaryToString($TcpRecvData),"|")  ;接受到的信息以“|”符号来分割到数组
                 $Jihao = StringRight($strepl,3)
        ;====代码结束=============================================================================
    $TcpRecvData = GUICtrlCreateListViewItem(BinaryToString($TcpRecvData, 4), $ListView1);将信息写入到$listview1控件
     ;===需要播放的代码如下=========================================================================
         _PLAYJH($Jihao)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2014-12-12 15:57:47 | 显示全部楼层
《求助 新手有难》综合写了个 网吧呼叫点餐的 语音呼叫有问题 如题
发表于 2014-12-12 17:20:27 | 显示全部楼层
代码不全没看出问题了,你那不是直接执行了吗... 直接执行了,就生效了啊~
发表于 2014-12-12 18:11:52 | 显示全部楼层
回复 2# mshuking


      _PLAYJH($Jihao) 调用这函数的参数哪里冒出来的?
这函数太多延迟,所以应该抽离出来编译成独立的EXE, 不然程序的响应肯定成问题.
发表于 2014-12-15 20:45:58 | 显示全部楼层
你这个代码可以精简!楼上说的是 延时一定很高!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 07:55 , Processed in 0.082831 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表