操作由操作类型(type)、动作(op)、自定义标签(label)和参数(args)组成,不同操作需要的参数个数也不同。
一个操作的代码结构如下:
<action type="类型" op="动作" label="标签名">
<args>
<arg>参数0</arg>
<arg>参数1</arg>
<arg>参数2</arg>
</args>
</action>
没有参数的操作可简化为:
<action type="类型" op="动作" label="标签名" />
没有标签的操作可简化为:
<action type="类型" op="动作" />
操作和动作的组合,可以生出万千变化。
<action type="APP" op="EXISTS">
<args>
<arg>全局变量名</arg>
<arg>进程名称</arg>
</args>
</action>
返回值:true(存在)、false(不存在)
<action type="FILE" op="EXISTS">
<args>
<arg>全局变量名</arg>
<arg>文件路径</arg>
</args>
</action>
返回值:true(存在)、false(不存在)
<action type="SCENE" op="EXISTS">
<args>
<arg>全局变量名</arg>
<arg>场景名称</arg>
</args>
</action>
返回值:true(存在)、false(不存在)
<action type="THIS" op="EXIT" />
<action type="APP" op="EXIT">
<args>
<arg>操作符</arg>
<arg>进程名称或应用路径</arg>
</args>
</action>
操作符用于指定匹配方式,参考配置中的操作符介绍。
<action type="SCENE" op="CREATE">
<args>
<arg>场景名称</arg>
</args>
</action>
<action type="UNIT" op="CREATE">
<args>
<arg>场景名称</arg>
<arg>控件名称</arg>
<arg>控件类型</arg>
</args>
</action>
创建的控件默认显示。
<action type="DIR" op="CREATE">
<args>
<arg>D:\\test</arg>
</args>
</action>
<action type="THIS" op="SHOW">
<args>
<arg>TASK</arg>
<arg>任务名称</arg>
</args>
</action>
<action type="THIS" op="SHOW">
<args>
<arg>TIP</arg>
<arg>标题</arg>
<arg>内容</arg>
</args>
</action>
<action type="THIS" op="SHOW">
<args>
<arg>ALERT</arg>
<arg>标题</arg>
<arg>内容</arg>
</args>
</action>
<action type="SCENE" op="SHOW">
<args>
<arg>场景名称</arg>
</args>
</action>
<action type="UNIT" op="SHOW">
<args>
<arg>场景名称</arg>
<arg>控件名称</arg>
</args>
</action>
<action type="FILE" op="SHOW">
<args>
<arg>文件路径</arg>
</args>
</action>
<action type="DIR" op="SHOW">
<args>
<arg>文件夹路径</arg>
</args>
</action>
<action type="THIS" op="HIDE">
<args>
<arg>TASK</arg>
<arg>任务名称</arg>
</args>
</action>
<action type="SCENE" op="HIDE">
<args>
<arg>场景名称</arg>
</args>
</action>
<action type="UNIT" op="HIDE">
<args>
<arg>场景名称</arg>
<arg>控件名称</arg>
</args>
</action>
<action type="FILE" op="HIDE">
<args>
<arg>文件路径</arg>
</args>
</action>
<action type="DIR" op="HIDE">
<args>
<arg>文件夹路径</arg>
</args>
</action>
<action type="SCREEN" op="LOCK" />
<action type="SOUND" op="CLOSE" />
<action type="SOUND" op="OPEN" />
<action type="SCENE" op="DESTROY">
<args>
<arg>场景名称</arg>
</args>
</action>
<action type="DIR" op="DESTROY">
<args>
<arg>D:\\test</arg>
<arg>true</arg>
</args>
</action>
<action type="FILE" op="DESTROY">
<args>
<arg>文件路径</arg>
</args>
</action>
<action type="GLOBAL" op="DESTROY">
<args>
<arg>变量名称</arg>
</args>
</action>
<action type="UNIT" op="DESTROY">
<args>
<arg>场景名称</arg>
<arg>控件名称</arg>
</args>
</action>
<action type="IMAGE" op="DESTROY" />
<action type="CLIP" op="WRITE">
<args>
<arg>字符串内容</arg>
</args>
</action>
<action type="SCENE" op="WRITE">
<args>
<arg>场景名称</arg>
<arg>属性名称</arg>
<arg>值</arg>
</args>
</action>
<action type="GLOBAL" op="WRITE">
<args>
<arg>全局变量名</arg>
<arg>值</arg>
</args>
</action>
<action type="UNIT" op="WRITE">
<args>
<arg>场景名称</arg>
<arg>控件名称</arg>
<arg>属性名称</arg>
<arg>值</arg>
</args>
</action>
<action type="SOUND" op="WRITE">
<args>
<arg>音量值(0-50的数字)</arg>
</args>
</action>
<action type="LOG" op="WRITE">
<args>
<arg>日志级别</arg>
<arg>日志内容</arg>
</args>
</action>
日志级别:debug、info、warn、error四种。
<action type="WINDOW" op="WRITE">
<args>
<arg>窗体句柄</arg>
<arg>属性名</arg>
<arg>属性值</arg>
</args>
</action>
支持的属性有:active(激活窗体,值为空);bringToFront(将窗体带到前面,值为空);windowState(设置窗体状态,可选值:Maximized、Minimized、Normal、Hide)
<action type="KEY" op="WRITE">
<args>
<arg>字符串(参考:键盘按键)</arg>
</args>
</action>
仅仅将键盘按键消息放入系统消息队列,不会等待执行完毕,即异步发送。若要同步发送,请使用KEY的WAIT操作。
<action type="IMAGE" op="WRITE">
<args>
<arg>属性名</arg>
<arg>属性值</arg>
</args>
</action>
支持的属性有:width(宽度)、height(高度)、size(使用该属性需要两个参数:width宽度、height高度)、color(指定像素点的颜色代码,如#000000,使用该属性需要三个参数:x坐标、y坐标、color颜色代码)、flip(翻转,参数x水平翻转,参数y垂直翻转)、crop(裁剪,使用该属性需要四个参数:x坐标、y坐标、width宽度、height高度)、base64(使用base64编码加载)
<action type="LOCAL" op="WRITE">
<args>
<arg>局部变量名</arg>
<arg>值</arg>
</args>
</action>
<action type="CLIP" op="READ">
<args>
<arg>自定义全局变量名</arg>
</args>
</action>
读取的内容将放入自定义全局变量中。
<action type="SCENE" op="READ">
<args>
<arg>自定义全局变量名</arg>
<arg>场景名称</arg>
<arg>属性名称</arg>
</args>
</action>
<action type="FILE" op="READ">
<args>
<arg>属性名</arg>
<arg>自定义全局变量名</arg>
<arg>文件路径</arg>
</args>
</action>
属性名包括:size(文件大小)、short_name(不含路径的文件名)、short_name_no_ext(不含后缀的文件名)、ext(后缀名)、directory(所在目录)
<action type="GLOBAL" op="READ">
<args>
<arg>自定义全局变量名</arg>
<arg>要读取的全局变量们</arg>
</args>
</action>
<action type="UNIT" op="READ">
<args>
<arg>自定义全局变量名</arg>
<arg>场景名称</arg>
<arg>控件名称</arg>
<arg>属性名称</arg>
</args>
</action>
<action type="WINDOW" op="READ">
<args>
<arg>窗体句柄</arg>
<arg>属性名</arg>
</args>
</action>
支持的属性有:text(窗体标题);left(横坐标);top(纵坐标);width(宽度);height(高度);visible(是否可见);handle(窗体句柄)
<action type="MEDIA" op="READ">
<args>
<arg>全局变量名</arg>
<arg>属性名</arg>
</args>
</action>
支持的属性有:file(当前媒体文件路径);length(当前媒体文件总秒数);current(当前媒体文件播放进度,单位:秒)
<action type="SCREEN" op="READ">
<args>
<arg>属性名</arg>
<arg>保存变量名</arg>
</args>
</action>
支持的属性有:width(屏幕宽度)、height(屏幕高度)。
<action type="SCREEN" op="READ">
<args>
<arg>color</arg>
<arg>保存变量名</arg>
<arg>x</arg>
<arg>y</arg>
</args>
</action>
x为横坐标,y为纵坐标。
<action type="SCREEN" op="READ">
<args>
<arg>capture</arg>
</args>
</action>
图片缓存在图像缓冲区(在itask未重启,图片未被替换,缓冲区未被清理时将一直存在),可调用IMAGE.SAVE保存到文件或进行其他相关处理。
<action type="IMAGE" op="READ">
<args>
<arg>属性名</arg>
<arg>保存变量名</arg>
</args>
</action>
属性名支持:width(宽度)、height(高度)、size(以逗号,分隔的宽度和高度)、color(指定像素点的颜色,使用该属性需要追加两个参数,x和y,代表像素点的横坐标和纵坐标)、base64(图片base64编码,需追加一个参数指定图片格式,如jpg、png等)。
<action type="APP" op="READ">
<args>
<arg>属性名</arg>
<arg>保存变量名</arg>
</args>
</action>
属性名支持:count(进程数量)、id(获取指定进程的id,需要追加一个参数:进程名称)、window_handle(获取指定进程的主窗体句柄,需要追加一个参数:进程名称)、window_title(获取指定进程的主窗体标题,需要追加一个参数:进程名称)。
<action type="LOCAL" op="READ">
<args>
<arg>全局变量名</arg>
<arg>局部变量名</arg>
</args>
</action>
<action type="DIR" op="LIST">
<args>
<arg>自定义全局变量名</arg>
<arg>文件夹路径</arg>
</args>
</action>
<action type="WINDOW" op="LIST">
<args>
<arg>自定义全局变量名</arg>
</args>
</action>
<action type="APP" op="LOAD">
<args>
<arg>Sndvol</arg>
</args>
</action>
<action type="CMD" op="LOAD">
<args>
<arg>执行结果保存至变量名</arg>
<arg>explorer http://6tail.cn</arg>
</args>
</action>
该方法将阻塞等待命令执行结果。
<action type="THIS" op="LOAD">
<args>
<arg>window.alert('hello world');</arg>
</args>
</action>
<action type="IMAGE" op="LOAD">
<args>
<arg>文件路径</arg>
</args>
</action>
加载的图片缓存在图像缓冲区(在itask未重启,图片未被替换,缓冲区未被清理时将一直存在)。
<action type="FILE" op="LOAD">
<args>
<arg>自定义全局变量名</arg>
<arg>文件路径</arg>
<arg>字符编码</arg>
</args>
</action>
<action type="THIS" op="RELOAD" />
<action type="DIR" op="SELECT" />
<action type="FILE" op="SELECT" />
<action type="HTTP" op="POST">
<args>
<arg>自定义全局变量名用于存储返回的html代码</arg>
<arg>url</arg>
<arg>数据内容,形如a=1&b=2</arg>
<arg>返回字符编码,空则尝试自动获取编码</arg>
<arg>请求头1,形如Host:6tail.cn</arg>
<arg>请求头2,形如Host:6tail.cn</arg>
<arg>请求头n,形如Host:6tail.cn</arg>
</args>
</action>
<action type="HTTP" op="GET">
<args>
<arg>自定义全局变量名用于存储返回的html代码</arg>
<arg>url</arg>
<arg>返回字符编码,空则尝试自动获取编码</arg>
<arg>请求头1,形如Host:6tail.cn</arg>
<arg>请求头2,形如Host:6tail.cn</arg>
<arg>请求头n,形如Host:6tail.cn</arg>
</args>
</action>
<action type="WINDOW" op="GET">
<args>
<arg>自定义全局变量名用于存储窗口句柄</arg>
</args>
</action>
<action type="FLOW" op="IF">
<args>
<arg>全局变量名</arg>
<arg>操作符</arg>
<arg>值</arg>
<arg>满足条件时跳过的步数</arg>
</args>
</action>
<action type="FLOW" op="RETURN" />
<action type="FLOW" op="GOTO">
<args>
<arg>跳至的步骤序号</arg>
</args>
</action>
<action type="FLOW" op="GOTO_LABEL">
<args>
<arg>标签名</arg>
</args>
</action>
<action type="FLOW" op="LABEL">
<args>
<arg>标签名</arg>
</args>
</action>
<action type="CMD" op="WAIT">
<args>
<arg>执行结果保存至全局变量名</arg>
<arg>explorer http://6tail.cn</arg>
</args>
</action>
该方法将阻塞等待命令执行结果。
<action type="FLOW" op="WAIT">
<args>
<arg>1000</arg>
</args>
</action>
<action type="KEY" op="WAIT">
<args>
<arg>字符串(参考:键盘按键)</arg>
</args>
</action>
等待按键消息被处理后才返回,即同步发送按键。若要异步发送,请使用KEY的WRITE操作。
<action type="CMD" op="PLAY">
<args>
<arg>explorer http://6tail.cn</arg>
</args>
</action>
该方法不会阻塞等待命令执行结果。
<action type="MEDIA" op="PLAY">
<args>
<arg>媒体路径</arg>
</args>
</action>
<action type="SOUND" op="PLAY">
<args>
<arg>Asterisk/Beep/Exclamation/Hand/Question</arg>
</args>
</action>
<action type="MIDI" op="PLAY">
<args>
<arg>0</arg>
<arg>4/4</arg>
<arg>80</arg>
<arg>G</arg>
<arg>-6,-7/,1/,2,3/,2/,1,1/,-7/,-6-,-6,-7/,1/,2,3/,2/,1/,-7/,1/,2/,3-,-6,-7/,1/,2,3/,2/,1,1/,-7/,-6-</arg>
</args>
</action>
以上示例模拟大钢琴音色播放《龙的传人》片段。
<action type="WINDOW" op="PLAY">
<args>
<arg>参数1:窗体句柄(字符串)</arg>
<arg>参数2:动画时长(数字,毫秒数)</arg>
<arg>参数3:动画类型标志(数字)</arg>
</args>
</action>
动画类型标志(可多种动画类型相加实现叠加效果):
1自左向右显示窗口。只能在滚动动画中使用。当使用16标志时,该标志将被忽略。
2自右向左显示窗口。只能在滚动动画中使用。当使用16标志时,该标志将被忽略。
4自上向下显示窗口。只能在滚动动画中使用。当使用16标志时,该标志将被忽略。
8自下向上显示窗口。只能在滚动动画中使用。当使用16标志时,该标志将被忽略。
16若使用65536,则窗口向内重叠;若未使用65536,则窗口向外扩展。
65536隐藏窗口。
131072激活窗口,不能和65536叠加。
262144滚动动画。当使用16标志时,该标志将被忽略。
524288淡入效果。
<action type="MEDIA" op="PAUSE" />
<action type="MIDI" op="PAUSE" />
<action type="MEDIA" op="RESUME" />
<action type="MIDI" op="RESUME" />
<action type="MEDIA" op="STOP" />
<action type="MIDI" op="STOP" />
<action type="SOUND" op="ADD" />
<action type="GLOBAL" op="ADD">
<args>
<arg>变量名</arg>
<arg>增加数值</arg>
</args>
</action>
只能对数字类型的变量进行加操作哦。
<action type="SOUND" op="MINUS" />
<action type="GLOBAL" op="MINUS">
<args>
<arg>变量名</arg>
<arg>减少数值</arg>
</args>
</action>
只能对数字类型的变量进行减操作哦。
<action type="GLOBAL" op="MULTIPLY">
<args>
<arg>变量名</arg>
<arg>乘数</arg>
</args>
</action>
只能对数字类型的变量进行乘操作哦。
<action type="GLOBAL" op="DEVIDE">
<args>
<arg>变量名</arg>
<arg>除数</arg>
</args>
</action>
只能对数字类型的变量进行除操作哦,除数不能为0。
<action type="GLOBAL" op="MOD">
<args>
<arg>变量名</arg>
<arg>除数</arg>
</args>
</action>
只能对数字类型的变量进行取模操作哦。
<action type="SOUND" op="BEEP">
<args>
<arg>声音频率(数字)</arg>
<arg>持续时长(数字)</arg>
</args>
</action>
<action type="MOUSE_LEFT" op="DOWN" />
<action type="MOUSE_RIGHT" op="DOWN" />
<action type="MOUSE_MIDDLE" op="DOWN" />
<action type="MOUSE_WHEEL" op="DOWN" />
<action type="MOUSE_LEFT" op="UP" />
<action type="MOUSE_RIGHT" op="UP" />
<action type="MOUSE_MIDDLE" op="UP" />
<action type="MOUSE_WHEEL" op="UP" />
<action type="MOUSE" op="CLICK" />
等同于鼠标左键点击。
<action type="MOUSE_LEFT" op="CLICK" />
<action type="MOUSE_RIGHT" op="CLICK" />
<action type="MOUSE_MIDDLE" op="CLICK" />
<action type="MOUSE_WHEEL" op="CLICK" />
<action type="MOUSE_WHEEL" op="FORWARD" />
<action type="MOUSE_WHEEL" op="BACK" />
<action type="MOUSE" op="MOVE">
<args>
<arg>X坐标(数字)</arg>
<arg>Y坐标(数字)</arg>
</args>
</action>
<action type="FILE" op="MOVE">
<args>
<arg>原路径(字符串)</arg>
<arg>新路径(字符串)</arg>
</args>
</action>
可用于重命名文件。
<action type="FILE" op="COPY">
<args>
<arg>原路径(字符串)</arg>
<arg>新路径(字符串)</arg>
<arg>是否覆盖(true/false)</arg>
</args>
</action>
<action type="IMAGE" op="SAVE">
<args>
<arg>路径(字符串)</arg>
</args>
</action>
<action type="FILE" op="SAVE">
<args>
<arg>文件路径</arg>
<arg>文件内容</arg>
<arg>是否追加(true/false)</arg>
<arg>字符编码</arg>
</args>
</action>
<action type="HTTP" op="SAVE">
<args>
<arg>自定义全局变量名用于存储下载结果</arg>
<arg>url</arg>
<arg>本地存储文件路径</arg>
<arg>请求头1,形如Host:6tail.cn</arg>
<arg>请求头2,形如Host:6tail.cn</arg>
<arg>请求头n,形如Host:6tail.cn</arg>
</args>
</action>
下载结果为true/false
为动作指定非空的标签,更便于流程控制时跳转。
在参数中可以使用以下代码,在实际运行时将被自动替换。