按键精灵的文件插件(File) | 信义之树

按键精灵的文件插件(File)

2018年02月24日 星期六 17:29:49 按键精灵 9,107 次 0

一、读写ini配置文件

Call plugin.file.WriteINI("补血配置","HP","80","C:\补血.ini")
text=plugin.file.ReadINI("补血配置","HP","C:\补血.ini")
TracePrint text

二、读写记事本

Call plugin.file.WriteFileEx("C:\测试.txt","大家好")
Call plugin.file.WriteFileEx("C:\测试.txt","我是信义之树")
Call plugin.file.WriteFileEx("C:\测试.txt","欢迎来到我的网站")
text=plugin.file.ReadFileEx("C:\测试.txt")
TracePrint text
MyArray=split(text,"|")
For i = 0 To UBound(MyArray) - 1
    TracePrint "第"&(i+1)&"行的内容为:"&MyArray(i)
Next

三、复制、重命名、移动、删除文件

Call plugin.file.CopyFile("C:\测试.txt","C:\测试2.txt")
Call plugin.file.ReNameFile("C:\测试.txt","C:\测试3.txt")
Call plugin.file.DeleteFile("C:\测试2.txt")
Call plugin.file.MoveFile("C:\测试3.txt","Y:\测试.txt")

四、弹出选择文件/文件夹对话框

path=plugin.file.SelectFile()
TracePrint path
path=plugin.file.SelectDirectory()
TracePrint path

五、办公文档插件(Office)

Call plugin.office.OpenXls("C:\测试.xls")
Call plugin.office.WriteXls(1,5,3,"信义之树")
text=plugin.office.ReadXls(1,5,3)
TracePrint text
Call plugin.office.CloseXls()