Extension =
{
Application = "xlWarKey",
Version = "3.0",
NameSpace = "http://www.streamlet.org/Software/xlWarKey/",
--以上三行固定
ExtensionName = "SampleExtension", --脚本名称
Author = "YourName", --脚本作者
Description = "This extension is rather good.", --脚本描述
--参数配置,使用方法见 喊话.lua
Configuration =
{
setting1 =
{
Type = "number",
Desc = "Please input an integer."
},
setting2 =
{
Type = "string",
Desc = "Please input a string."
}
-- ...
},
--运行时,上面 setting1 和 setting2 都将被直接替换为用户设置的值
--入口函数
Entrance = function (id) --参数 id 仅仅是保留着以便将来使用,目前请忽略
local config = Extension.Configuration;
-- 所有代码都请写在这里
-- ...
return true; --返回值也保留,将来使用,请 return true。
end
};
常量 Keys
常用键值声明,方便使用
分量:
1、Windows 定义的 VK_*,如 Keys.VK_F1 表示 F1 键
2、字母键和数字键,Keys.VK_A 到 Keys.VK_Z,Keys.VK_0 到 Keys.VK_9
常量 Mouse
常用鼠标按键和滚轮声明,方便使用
分量:
1、鼠标按键,Mouse.LBUTTON,Mouse.RBUTTON,Mouse.MBUTTON,Mouse.XBUTTON1,Mouse.XBUTTON2
2、鼠标滚轮,Mouse.WHEEL,Mouse.HWHEEL
函数 void DebugPrint(string message)
向 Log 文件(xlWarKey.log)输出一行文字,供调试使用,调试完毕请删除
参数 1:string,要输出的文字
函数 void PressKey(number vkcode [, boolean ctrl [, boolean shift [, boolean alt [, boolean win]]]])
按下某键
参数 1:number,要按下的键的虚拟键值,请使用常量 Keys.VK_* 指定
参数 2:boolean,是否按住 Ctrl 键
参数 3:boolean,是否按住 Shift 键
参数 4:boolean,是否按住 Alt 键
参数 5:boolean,是否按住 Win 键
函数 void ReleaseKey(number vkcode [, boolean ctrl [, boolean shift [, boolean alt [, boolean win]]]])
放开某键
参数同 PressKey
函数 void MoveMouse(number x, number y)
移动鼠标光标
参数 1:number,目标点的横坐标,坐标值为相对于系统前景窗口客户区左边的距离
参数 2:number,目标点的纵坐标,坐标值为相对于系统前景窗口客户区上边的距离
函数 void PressMouseButton(number button)
按下鼠标按键
参数 1:number,要按下的鼠标键,请使用常量 Mouse.*BUTTON* 指定
函数 void ReleaseMouseButton(number button)
放开鼠标按键
参数同 PressMouseButton
函数 void MouseWheel(number button, number delta)
滚动鼠标滚轮
参数 1:number,要按下的鼠标键,请使用常量 Mouse.*WHEEL* 指定
参数 2:number,要滚动的距离,正数向上(右)滚动,负数向下(左)滚动
函数 void SetClipboard(string text)
设置剪贴板数据,此函数只能设置纯文本(CF_TEXT)数据格式
函数 number, number GetClientSize()
取系统前景窗口客户区大小
返回值 1:number,取得的宽度
返回值 2:number,取得的高度
函数 number, number GetCursorPosition()
取当前鼠标光标位置
返回值 1:number,取得的横坐标,坐标值为相对于系统前景窗口客户区左边的距离
返回值 2:number,取得的纵坐标,坐标值为相对于系统前景窗口客户区上边的距离
函数 void Delay(number milliseconds)
脚本停止执行一定的时间,起到延时效果
参数 1:number,延时时间,单位为毫秒
函数 string AnsiToUtf8(string ansi)
ANSI 字符串转 UTF-8
参数 1:string,ANSI 编码的字符串
返回值 1:string,UTF-8 编码的字符串