重要!这不是正确的方法!这只是我需要实现的快速技巧。直接连接到Avaya DB会更好。 Windows Task Scheduler变慢。这只会在本地网络上运行。
我对此快速黑客的计划是:
它将看起来像这样:
Some Nice Service Desk
2,Martin Scorsese,8869711,5543711,,AVAIL,0,47,
5,Alfred Hitchcock,8869712,5543732,Default,AUX,0,785,
5,Stanley Kubrick,8869714,5543722,Default,AUXOUT,173,85,
2,Francis Ford Coppola,8869715,5543733,,AVAIL,0,1252,
5,John Huston,8869713,5543743,Default,AUXOUT,173,186,
CREATE TABLE `avaya_live_report` (
`icon_number` TINYINT unsigned NOT NULL,
`agent_name` TINYTEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`agent_number` INT unsigned NOT NULL,
`extension` INT unsigned NOT NULL,
`state_type` TINYTEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`state` TINYTEXT NOT NULL,
`zero` TINYINT unsigned NOT NULL,
`time` SMALLINT unsigned NOT NULL,
`empty` TINYTEXT NOT NULL);
由于不可能在MySQL上将Load Data安排为预定的重新获取事件:
LOAD DATA INFILE 'C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Uploads\\live_report.txt'
INTO TABLE avaya_live_report
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES;
我需要直接从.acsauto脚本连接到MySQL:
'LANGUAGE=ENU
'SERVERNAME=SOME_NICE_IP_ADDRESS
Public Sub Main()
'## begin
'## ID = 1000
'## Description = "Report: Real-Time: Agent: Agent Group Report: Export Data"
'## Parameters.Add "Report: Real-Time: Agent: Agent Group Report: Export Data","_Desc"
'## Parameters.Add "Reports","_Catalog"
'## Parameters.Add "2","_Action"
'## Parameters.Add "1","_Quit"
'## Parameters.Add "Real-Time\Agent\Agent Group Report","_Report"
'## Parameters.Add "1","_ACD"
'## Parameters.Add "1335","_Top"
'## Parameters.Add "2580","_Left"
'## Parameters.Add "6930","_Width"
'## Parameters.Add "4575","_Height"
'## Parameters.Add "default","_TimeZone"
'## Parameters.Add "The report Real-Time\Agent\Agent Group Report was not found on ACD 1.","_ReportNotFound"
'## Parameters.Add "*","_BeginProperties"
'## Parameters.Add "Nice Service Desk","Agent Group"
'## Parameters.Add "*","_EndProperties"
'## Parameters.Add "*","_BeginViews"
'## Parameters.Add "*","_EndViews"
'## Parameters.Add "C:\Scripts\live.txt","_Output"
'## Parameters.Add "9","_FldSep"
'## Parameters.Add "0","_TextDelim"
'## Parameters.Add "False","_NullToZero"
'## Parameters.Add "False","_Labels"
'## Parameters.Add "True","_DurSecs"
On Error Resume Next
cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Real-Time\Agent\Agent Group Report")
If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Real-Time\Agent\Agent Group Report was not found on ACD 1.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("ACSERR.cvsLog")
Log.AutoLogWrite "The report Real-Time\Agent\Agent Group Report was not found on ACD 1."
Set Log = Nothing
End If
Else
b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then
Rep.Window.Top = 1335
Rep.Window.Left = 2580
Rep.Window.Width = 6930
Rep.Window.Height = 4575
Rep.TimeZone = "default"
Rep.SetProperty "Agent Group","Nice Service Desk"
' StackOverflow PLEASE START READING HERE
' This loop lets me action something and then wait for 30 seconds in a loop
For i=1 To 10
' This line creates this nice comma separated txt file (Using TXT file is a lot faster then CSV)
b = Rep.ExportData("C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\live_report.txt", 44, 0, True, False, True)
Dim dteWait
'30 sek
dteWait = DateAdd("s", 30, Now())
Do Until (Now() > dteWait)
Loop
Next
Rep.Quit
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If
End If
Set Info = Nothing
'## cvs_cmd_end
End Sub
而且我需要将此与MySQL的连接集成到上述脚本中。显然,以下脚本只是VBA Excel脚本,因此非常棘手。
连接
conMySQL.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=" & server & ";" & " DATABASE=" & database & ";" & "UID=" & login_user & ";PWD=" & password & "; OPTION=3; PORT=" & port & ";Connect Timeout=20;"
conMySQL.Open
查询
strSQL = "SELECT x FROM some_table"
MySQL.Query (strSQL)
With rsTemporary
Do Until .EOF
recordCount = recordCount + 1
some_variable = ![supcode]
rsTemporary.MoveNext
Loop
End With
MySQL.closeCon
我已经安装了ODBC驱动程序,但除此之外,我在我的开发环境中只有Avaya CMS Supervisor版本19.0 + MySQL 8.0.19。
我的问题:是否有人尝试将此MySQL连接集成到.acsauto Avaya脚本中?
谢谢你。KK
因此,很多年前,我使用SQL,并且能够弄清楚如何创建表,删除表以及将记录插入表中。下面是将记录插入到Sql表中
'LANGUAGE=ENU
'SERVERNAME=xxx.xxx.xxx.xxx
Public Sub Main()
On Error Resume Next
StrConnect = "Driver={SQL Server};Server=xxx.xxx.xxx.xxx\QLIS,2026;Database=OADB;UID=xxxxxxx;PWD=xxxxxxx"
Set cnt = CreateObject("ADODB.Connection")
cnt.Open StrConnect
set recordSet = CreateObject("ADODB.Recordset")
SQLStr = "Select * from tmpCMSData2 "
recordSet.Open SQLStr, cnt, 1, 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Inetpub\wwwroot\Telecom\COOL_TEXT.txt", 1)
If (objFSO.FileExists("C:\Inetpub\wwwroot\Telecom\COOL_TEXT.txt")) Then
Do Until objFile.AtEndOfStream
strCharacter = objFile.Read(1)
strLine = objFile.ReadLine
For z = Ubound(strLine) to LBound(strLine) Step -1
arrProcessLines = Split(strLine,",")
'##msgbox(arrProcessLines(3))
cnt.Execute "INSERT INTO tmpCMSData2 (Extension, Workmode, Direction)VALUES(" & arrProcessLines(0) & "," & arrProcessLines(1) & "," & arrProcessLines(2) & ")"
Next
Loop
else
strFileExists = Msgbox("no")
End If
End Sub
创建表是:
cnt.Execute "CREATE TABLE tmpCMSData2 (Extension int,Workmode int,Direction int, Duration int, Split int, OnHold int, ACD int, AuxReason int, LogID int, CID varchar(25))"
我在COOL_TEXT.txt文件中导入的数据的示例是:
Extn,State,Direction,Time,Split/Skill,ONHOLD,ACD,AUX Reason,Login ID
21281,AUX,0,327,10,0,1,General,42554
17334,AUX,0,1049,10,0,1,General,47322
68909,AUX,IN,71,10,0,1,General,45466
16425,AUX,0,11856,10,0,1,General,48103
16322,AUX,0,2773,10,0,1,General,45955
21394,AVAIL,0,278,10,0,1,,47633
17501,AUX,0,10463,10,0,1,General,48513
16360,AUX,0,3811,10,0,1,General,45996
21305,AUX,0,10229,10,0,1,General,44873
希望这会有所帮助!
戴夫M。