Sub 初始化
PutAttachment "c:\test_game","."
Set ws = CreateObject("Wscript.Shell")
ws.run "regsvr32 ""c:\test_game\LazyOffice.dll"" /s"
path =Form1.BrowseBox1.Path
Set LazyExcel= CreateObject("Lazy.LxjExcel")
Index = LazyExcel.ExcelOpen(path, 1)
脚本日志 "初始化"
End Sub
Sub 脚本日志(参数)
日志累计数 = 日志累计数 + 1
If 日志累计数 >= 50 Then
Form1.日志.List = ""
日志累计数 = 0
End If
Form1.日志.List="["&time()&"]: "&参数&"|"&Form1.日志.List
End Sub
Event Form1.Button2.Click
Call 初始化
End Event
Sub OnScriptExit()
脚本日志 "全部处理完成"
End Sub
Event Form1.Button1.Click
newname = Form1.InputBox1.Text
exepath = Plugin.SysEx.GetDir(0)
If len(newname) = 0 Then
MessageBox "内容为空"
Else
Call Plugin.lxj_Plug.lxj_WriteTXT(exepath & "/配置文件.ini", newname & chr(10), "GB2312")
MessageBox "增加成功"
End If
Form1.InputBox1.Text = ""
End Event
Event Form1.Button3.Click
exepath = Plugin.SysEx.GetDir(0)
Call Plugin.File.DeleteFile(exepath & "/配置文件.ini")
MessageBox "配置文件已清空"
End Event
Event Form1.Button4.Click
Call 初始化
Dim LazyExcel,path,Index,Str
path =Form1.BrowseBox1.Path
Set LazyExcel= CreateObject("Lazy.LxjExcel")
Index = LazyExcel.ExcelOpen(path, 1)
SET Rang = LazyExcel.ObjRange(1, "A:C", index)
Rang.RemoveDuplicates 3 //以第3列去重
exepath = Plugin.SysEx.GetDir(0)'获取当前路径
脚本日志 "获得路径:" & exepath
text = Plugin.File.ReadFileEx(exepath &"/配置文件.ini")
Dim myarray
myarray = split(text, "|")'读取文本内容放进数组
脚本日志 "当前有:"&UBound(myarray)&"个账号待处理"
If UBound(myarray) > 0 Then '最大下标
i = 0
For UBound(myarray)
SayString cstr(myarray(i)) '数字转换String
Delay 1000
Delay 100
名称 = "="&cstr(myarray(i))&""
Arr = LazyExcel.ExcelFilter(1, 1, 2, 名称, Index)
//筛选
Call LazyExcel.SheetAdd(1,Index)
//添加标签页
Call LazyExcel.ExcelCopyTo(2, "A:C,"&Index, 1, "A:C,"&Index, 0)
//数据复制过来
RCount = LazyExcel.SheetRowsCount(1, Index) '第一页表格数据有多少
For NN = 2 To RCount '我们系统导出的是csv文件,需要处理一下
phone = LazyExcel.ExcelRead(1, NN, 1, Index)
Call LazyExcel.ExcelWrite(1, NN, 1, phone, Index)
Next
Maxnum = LazyExcel.SheetRowsCount(1, Index)
For qqq = 2 To Maxnum
thename = LazyExcel.ExcelRead(1, qqq, 1, Index)
thephone = LazyExcel.ExcelRead(1, qqq, 3, Index)
lineone = "BEGIN:VCARD" & chr(10) & "VERSION:2.1" & chr(10) & "FN:" & thename & chr(10) & "N:;" & thename & ";;;" & chr(10) & "TEL;CELL:" & thephone & chr(10) & "END:VCARD" & chr(10)
Call Plugin.lxj_Plug.lxj_WriteTXT("C:\通讯录导出\" & myarray(i) & ".vcf", lineone , "UTF-8")
Next
path = LazyExcel.ExcelPath(Index)
Call LazyExcel.SheetDel(1, Index)
Call LazyExcel.ExcelFilterOver(1, Index)
脚本日志 myarray(i) & "处理完成"
i = i + 1
Next
Else
MessageBox "没有配置文件"
End If
Call LazyExcel.ExcelClose(Index)
End Event