3.0 版脚本 API 参考
本页将列举溪流 WarKey 3.0 脚本中可用的 API 列表。因为 3.0 版本还未正式发布,所以本列表也有可能更新。但已公布的部分将尽量不再改动,请放心使用。

脚本格式:

Extension =
{
    Application     = "xlWarKey",  --请勿修改
    Version         = "3.0",  --请勿修改
    NameSpace       = "http://www.streamlet.org/xlwarkey_api_3.0.php",  --请勿修改

    ExtensionName   = "SampleExtension",
    Description     = "This is a sample extension.",
    Author          = "Your Name",

    Configuration   =
    {
        setting1    = --设置项1
        {
            Type    = "number",
            Desc    = "Please input an integer."
        },
        setting2    = --设置项2
        {
            Type    = "string",
            Desc    = "Please input a string."
        }
        --其他设置项
    },

    Entrance      = function (id) -- 入口函数
        -- 所有代码都请写在这里
        return true;  --必须返回 true 或者 false。返回值意义目前暂未定义。
    end
};


预设全局变量:

名称 Keys
说明 设置了一系列虚拟键码常量,如 Keys.VK_F1, Keys.VK_ESCAPE 等。这些虚拟键码的字面表示与 Windows SDK 中一致,详情请参考
http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx

对于 Windows SDK 中未符号化的字母键以及数字键,可以使用 VK_A, VK_B, ……, VK_Z 以及 VK_0, VK_1, ……, VK_9。


函数参考:

名称 void PressKey(number vkcode [,
boolean ctrl [, boolean shift [, boolean alt [, boolean win]]]])
说明 按下某键。
第一个参数为虚拟键码,可以直接使用 Keys.VK_*。
后面四个表示状态键是否被按下。默认 false。
例:若要按下 Ctrl+1,可写成
PressKey(Keys.VK_1, true, false, false, false);
也可简写为 PressKey(Keys.VK_1, true)。



名称 void ReleaseKey(number vkcode [,
boolean ctrl [, boolean shift [, boolean alt [, boolean win]]]])

说明 同上,放开某键。


名称 void MoveMouse(number x, number y)
说明 移动鼠标到 (x, y) 位置。此坐标相对于魔兽窗口。


名称 void PressMouseButton(number button)
说明  按下鼠标按钮

button:
1 - Left
2 - Right
3 - XButton1
4 - XButton2


名称 void ReleaseMouseButton(number button)
说明 放开鼠标按钮,button 同上。


名称 void MouseWheel(number button, number delta)
说明 滚动鼠标滚轮

button:
1 - Wheel
2 - HWheel

delta: 要滚动的距离,可为负。


名称 void SetClipboard(string str)
说明 将一个字符串放到剪贴板


名称 string AnsiToUtf8(string ansi)
说明 将 Ansi 字符串转换为 UTF-8


名称 width, height GetClientSize()
说明 取魔兽窗口大小。


名称 x, y GetCursorPosition()
说明 取鼠标光标当前位置。此坐标相对于魔兽窗口。


名称 void Delay(number milliseconds)
说明 等待一段时间,参数的单位是毫秒。

如有需要更多的 API,请到论坛反馈。
如果您创建了一些较好的脚本,您可以申请将其包含在溪流 WarKey 中发布。

 
 
Valid XHTML 1.0 Strict
 
Copyright © 2010 Streamlet Studio. All rights reserved.