Hi,
Im using the following code below:
'LANGUAGE=ENG
'SERVERNAME=xxx.xxx.xxx.xx
Public Sub Main()
'Place a ";" separated file name agents.txt on the root of C drive
'This file needs to have the agent format: Cyril;1234 on every line
'This line will be read and split on the ";" and put in an array to add into CMS
l=0 'loop value for read loop
result=0 'Answer on adding
c=0 'counter for giving the messagebox
dim regel, a 'variabel for readline and for splitting on ";"
dim sString 'variable for information on adding data
dim NameArray(999) 'define array for agent name. All data is read into this from agents.txt
dim NumberArray(999) 'define array for agent number
dim fs, f 'define filesystem stuff for read
Dim agAdded
Dim agModif
Dim ress
cvsSrv.Dictionary.ACD = 1
'Reads file one line at a time into name and number array
'Place the textfile on the root of C drive
Set fs=CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile("C:\Users\joseph.mateo\Desktop\agents.txt", 1)
Dim ss
Do While f.AtEndOfStream <> True
'result = msgbox (regel, 1, "regel")
regel = f.ReadLine
a = split(regel,";")
NameArray(l) = a(0)
NumberArray(l) = a(1)
l=l+1
'regel = f.ReadLine
Loop 'keep reading in data until EOF hit.
'a = split(regel,";")
'NameArray(l) = a(0)
'NumberArray(l) = a(1)
f.Close 'close agents.txt file
Set f=Nothing 'clear f and fs
Set fs=Nothing
'Read all agents into string and display it in a messagebox
for c = 0 to l-1
sString = sString & NumberArray(c) & " - " & nameArray (c) & (Chr(13) & Chr(10))
next
result = msgbox (sString, 1, "Sure to Modify these Agents?")
if result = 1 then
sString = "" 'make string empty for next use
'Modify entries
b = cvsSrv.Dictionary.CreateOperation("Login Identifications",Op)
'b2 = cvsSrv.Dictionary.CreateOperation("Login Identifications",Op)
Op.Window.Top = 4490
Op.Window.Left = 4680
Op.Window.Width = 6000
Op.Window.Height = 2540
agAdded = 0
agModif = 0
for c = 0 to l-1
If b Then
Op.SetProperty "login_id", NumberArray(c)
Op.SetProperty "ag_name", NameArray(c)
On Error Resume Next
if b = Op.DoAction("Modify") then
agModif = agModif + 1
else
sString = sString & " " & NumberArray(c) & (Chr(13) & Chr(10))
b2 = Op.DoAction("Add")
if Not(b2) Then
result = msgbox (NameArray(c), 64, "failed adding user")
else
agAdded = agAdded + 1
End If
end if
End If
next
ress = "Agents Added " & agAdded & " Agents Modified " & agModif
result = msgbox (ress, 64, "Result")
' if sString <> "toto" then
'msgbox sString, 64, "Following Agents Already Exist"
'else
'msgbox "All Agents Modify", 64, "Operation Succesfull"
' end if
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Op.TaskID
Set Op = Nothing
end if
end Sub
------------
im getting an error with: "[line 7] (null)" message
appreciate your hels Sirs.
TIA
Im using the following code below:
'LANGUAGE=ENG
'SERVERNAME=xxx.xxx.xxx.xx
Public Sub Main()
'Place a ";" separated file name agents.txt on the root of C drive
'This file needs to have the agent format: Cyril;1234 on every line
'This line will be read and split on the ";" and put in an array to add into CMS
l=0 'loop value for read loop
result=0 'Answer on adding
c=0 'counter for giving the messagebox
dim regel, a 'variabel for readline and for splitting on ";"
dim sString 'variable for information on adding data
dim NameArray(999) 'define array for agent name. All data is read into this from agents.txt
dim NumberArray(999) 'define array for agent number
dim fs, f 'define filesystem stuff for read
Dim agAdded
Dim agModif
Dim ress
cvsSrv.Dictionary.ACD = 1
'Reads file one line at a time into name and number array
'Place the textfile on the root of C drive
Set fs=CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile("C:\Users\joseph.mateo\Desktop\agents.txt", 1)
Dim ss
Do While f.AtEndOfStream <> True
'result = msgbox (regel, 1, "regel")
regel = f.ReadLine
a = split(regel,";")
NameArray(l) = a(0)
NumberArray(l) = a(1)
l=l+1
'regel = f.ReadLine
Loop 'keep reading in data until EOF hit.
'a = split(regel,";")
'NameArray(l) = a(0)
'NumberArray(l) = a(1)
f.Close 'close agents.txt file
Set f=Nothing 'clear f and fs
Set fs=Nothing
'Read all agents into string and display it in a messagebox
for c = 0 to l-1
sString = sString & NumberArray(c) & " - " & nameArray (c) & (Chr(13) & Chr(10))
next
result = msgbox (sString, 1, "Sure to Modify these Agents?")
if result = 1 then
sString = "" 'make string empty for next use
'Modify entries
b = cvsSrv.Dictionary.CreateOperation("Login Identifications",Op)
'b2 = cvsSrv.Dictionary.CreateOperation("Login Identifications",Op)
Op.Window.Top = 4490
Op.Window.Left = 4680
Op.Window.Width = 6000
Op.Window.Height = 2540
agAdded = 0
agModif = 0
for c = 0 to l-1
If b Then
Op.SetProperty "login_id", NumberArray(c)
Op.SetProperty "ag_name", NameArray(c)
On Error Resume Next
if b = Op.DoAction("Modify") then
agModif = agModif + 1
else
sString = sString & " " & NumberArray(c) & (Chr(13) & Chr(10))
b2 = Op.DoAction("Add")
if Not(b2) Then
result = msgbox (NameArray(c), 64, "failed adding user")
else
agAdded = agAdded + 1
End If
end if
End If
next
ress = "Agents Added " & agAdded & " Agents Modified " & agModif
result = msgbox (ress, 64, "Result")
' if sString <> "toto" then
'msgbox sString, 64, "Following Agents Already Exist"
'else
'msgbox "All Agents Modify", 64, "Operation Succesfull"
' end if
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Op.TaskID
Set Op = Nothing
end if
end Sub
------------
im getting an error with: "[line 7] (null)" message
appreciate your hels Sirs.
TIA