(I think I posted this in the wrong place first...so I apologize for the double posting!)
I am trying to set up a .csv file that will contain Agent Skill changes that can be invoked by a CMS script. My problem is my limitation in knowledge of vbscripting.
Here's our concept: The agent IDs/Skills are in an Access db. A mgr selects the agents to be reset/changed. It creates a .csv file, one line per agent.
Can someone please help us with this script? We need to read one line, set the array/variables, and then loop back to the next line until the file is done. Any help would be greatly appreciated!
TEST.csv looks like this:
Agent ID,SK1,Lvl1,Reserve1,SK2,Lvl2,Reserve2....etc.
'LANGUAGE=ENU
'SERVERNAME=10.1.xxx.xx
Public Sub Main()
i = 0 'loop value
Dim sString 'Temporary string to parse *.csv data
Dim vArray 'define array. All data is read into this from test.csv Array
Dim fs, f 'define filesystem stuff for read
'Reads file one line at a time into vArray array
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("C:\temp\test.csv", 1)
sString = f.ReadLine & ","
Do While f.AtEndOfStream <> True
sString = sString & f.ReadLine & ","
Loop 'keep reading in data until EOF hit.
f.Close 'close test.csv file
Set f = Nothing 'clear f and fs
Set fs = Nothing
vArray = Split(sString, ",")
vArraySize = UBound(vArray) + 1 'Determine the size vArray
'## cvs_cmd_begin
'## ID = 8000
'## Description = "Acd Administration, Change Agent Skills"
'## Parameters.Add "Acd Administration","SubSystem"
'## Parameters.Add "Change Agent Skills 5510000 - Doe, Jane","FormName"
'## Parameters.Add "-1","DummyType"
'## Parameters.Add "-1","DummyAcd"
'## Parameters.Add "1","Action"
'## Parameters.Add "1","SetSk_Acd"
'## Parameters.Add "5510000","SetSk_AgentID"
'## Parameters.Add "1","SetSk_CallHandPref"
'## Parameters.Add "0","SetSk_DirectSkill"
'## Parameters.Add "0","SetSk_DirectFirst"
'## Parameters.Add "0","SetSk_ServiceObjective"
'## Parameters.Add "2","SetSk_NumofSkills"
'## Parameters.Add "14","BeginSetSkills"
'## Parameters.Add "905",""
'## Parameters.Add "1",""
'## Parameters.Add "0",""
'## Parameters.Add "333",""
'## Parameters.Add "3",""
'## Parameters.Add "0",""
'## Parameters.Add "","SetSk_Warning"
i = 0 'Reset counter
Do While i < vArraySize - 1
On Error Resume Next
set AgMngObj = cvsSrv.AgentMgmt
ReDim SetArr (2,3)
SetArr(1,1)= 905
SetArr(1,2)= 1
SetArr(1,3)= 0
SetArr(2,1)= 333
SetArr(2,2)= 4
SetArr(2,3)= 0
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill 1, "5510000",1, 0,0, 0, 2,SetArr, ""
'## cvs_cmd_end
End Sub
I am trying to set up a .csv file that will contain Agent Skill changes that can be invoked by a CMS script. My problem is my limitation in knowledge of vbscripting.
Here's our concept: The agent IDs/Skills are in an Access db. A mgr selects the agents to be reset/changed. It creates a .csv file, one line per agent.
Can someone please help us with this script? We need to read one line, set the array/variables, and then loop back to the next line until the file is done. Any help would be greatly appreciated!
TEST.csv looks like this:
Agent ID,SK1,Lvl1,Reserve1,SK2,Lvl2,Reserve2....etc.
'LANGUAGE=ENU
'SERVERNAME=10.1.xxx.xx
Public Sub Main()
i = 0 'loop value
Dim sString 'Temporary string to parse *.csv data
Dim vArray 'define array. All data is read into this from test.csv Array
Dim fs, f 'define filesystem stuff for read
'Reads file one line at a time into vArray array
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("C:\temp\test.csv", 1)
sString = f.ReadLine & ","
Do While f.AtEndOfStream <> True
sString = sString & f.ReadLine & ","
Loop 'keep reading in data until EOF hit.
f.Close 'close test.csv file
Set f = Nothing 'clear f and fs
Set fs = Nothing
vArray = Split(sString, ",")
vArraySize = UBound(vArray) + 1 'Determine the size vArray
'## cvs_cmd_begin
'## ID = 8000
'## Description = "Acd Administration, Change Agent Skills"
'## Parameters.Add "Acd Administration","SubSystem"
'## Parameters.Add "Change Agent Skills 5510000 - Doe, Jane","FormName"
'## Parameters.Add "-1","DummyType"
'## Parameters.Add "-1","DummyAcd"
'## Parameters.Add "1","Action"
'## Parameters.Add "1","SetSk_Acd"
'## Parameters.Add "5510000","SetSk_AgentID"
'## Parameters.Add "1","SetSk_CallHandPref"
'## Parameters.Add "0","SetSk_DirectSkill"
'## Parameters.Add "0","SetSk_DirectFirst"
'## Parameters.Add "0","SetSk_ServiceObjective"
'## Parameters.Add "2","SetSk_NumofSkills"
'## Parameters.Add "14","BeginSetSkills"
'## Parameters.Add "905",""
'## Parameters.Add "1",""
'## Parameters.Add "0",""
'## Parameters.Add "333",""
'## Parameters.Add "3",""
'## Parameters.Add "0",""
'## Parameters.Add "","SetSk_Warning"
i = 0 'Reset counter
Do While i < vArraySize - 1
On Error Resume Next
set AgMngObj = cvsSrv.AgentMgmt
ReDim SetArr (2,3)
SetArr(1,1)= 905
SetArr(1,2)= 1
SetArr(1,3)= 0
SetArr(2,1)= 333
SetArr(2,2)= 4
SetArr(2,3)= 0
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill 1, "5510000",1, 0,0, 0, 2,SetArr, ""
'## cvs_cmd_end
End Sub