Class App

App 对象

方法

App:Info (key) 获取 信息
App:Exec () 调用 子程序 (等待程序结束)
App:Run () 启动 程序 (不等待)
App:Sleep (ms) 暂停 当前进程(线程)执行, 用于等待或者延时处理
App:SetTimer (id, interval) 注册 计时器
App:KillTimer (id) 结束 计时器
App:Print (...) 输出 信息
App:JCfg (section, key1[, key2[, ...]]) 获取 WinXShell.jcfg中的配置参数

事件函数

App:OnLoad () 程序启动事件
App:OnDaemon () 作为常驻进程时,启动事件
App:OnTimer () 计时器事件


方法

App:Info (key)
获取 信息

Parameters:

  • key string

    信息名

    • CmdLine - 命令行
    • Path - 程序所在目录
    • Name - 程序文件名
    • FullName - 程序完整路径名
    • IsShell - 是否WinXShell作为系统外壳程序

Returns:

    请查看实例代码

Usage:

    -- WinXShell.exe -script info.lua
    -- info.lua
     App:Info('CmdLine')
     ---> '-script info.lua'
    
    App:Info('Path')
     ---> C:\Program Files\WinXShell
    
    App:Info('Name')
     ---> WinXShell.exe
    
    App:Info('FullName')
     ---> C:\Program Files\WinXShell\WinXShell.exe
    
    App:Info('IsShell')
     ---> 0
App:Exec ()
调用 子程序 (等待程序结束)
App:Run ()
启动 程序 (不等待)
App:Sleep (ms)
暂停 当前进程(线程)执行, 用于等待或者延时处理

Parameters:

  • ms int 暂停时间 (毫秒)

Usage:

    WinXShell.exe -console -code App:Sleep(5000)
App:SetTimer (id, interval)
注册 计时器

Parameters:

  • id int 计时器标识号 (请使用 TID_USER + 数字形式 设置,
    小于 TID_USER (20000) 以下的标识号作为程序内部计时器标识号)
  • interval int 时间间隔 (毫秒)

Usage:

    local TID_REFRESH_APP = TID_USER + 1        -- TID_USER = 20000
    App:SetTimer(TID_REFRESH_APP, 2000)
App:KillTimer (id)
结束 计时器

Parameters:

  • id int 计时器标识号
App:Print (...)
输出 信息

Parameters:

  • ...
App:JCfg (section, key1[, key2[, ...]])
获取 WinXShell.jcfg中的配置参数

Parameters:

  • section string 段名
  • key1 string 项目名
  • key2 string 项目名 (optional)
  • ... (optional)

事件函数

App:OnLoad ()
程序启动事件
App:OnDaemon ()
作为常驻进程时,启动事件
App:OnTimer ()
计时器事件
generated by LDoc 1.4.6