### wssNetServerObject.Start Source: https://www.aardio.com/zh-cn/docs/library-reference/web/SocketSharp/_.html Starts the WebSocket server. ```APIDOC ## wssNetServerObject.Start() ### Description Starts the WebSocket server instance. ``` -------------------------------- ### wsock.tcp.socks5Server.async() Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/socks5Server.html 创建异步 SOCKS 代理服务端。该方法在后台线程启动,调用 start 后立即返回。 ```APIDOC ## wsock.tcp.socks5Server.async(IP, 端口, 用户名, 密码) ### 描述 创建多线程 SOCKS 代理服务端,并在后台线程异步启动。调用 start 方法会立即返回,并可直接调用 stop 方法停止服务。 ### 参数 - **IP** (string) - 可选 - 服务端监听 IP,默认为 "0.0.0.0" - **端口** (number) - 可选 - 服务端监听端口,默认为 1080 - **用户名** (string) - 可选 - 认证用户名 - **密码** (string) - 可选 - 认证密码 ``` -------------------------------- ### HttpSimpleServerMainObject.start Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/simpleHttpServer.html Starts the HTTP server with the specified IP, port, and request queue size. ```APIDOC ## HttpSimpleServerMainObject.start(IP, 端口, 请求队列大小) ### Description Starts the HTTP server instance. ### Parameters - **IP** (string) - The IP address to bind to. - **端口** (number) - The port number to listen on. - **请求队列大小** (number) - The size of the request queue. ``` -------------------------------- ### wssNetHttpServerObject.Start Source: https://www.aardio.com/zh-cn/docs/library-reference/web/SocketSharp/_.html Starts the WebSocket HTTP server. ```APIDOC ## wssNetHttpServerObject.Start() ### Description Initializes and starts the WebSocket server instance. ``` -------------------------------- ### HttpSimpleServerObject.listen() Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/simpleHttpServer.html Starts listening on the bound IP and port. ```APIDOC ## HttpSimpleServerObject.listen(requestQueueSize) ### Description Listens on the IP and port defined in the constructor. Returns true on success. ``` -------------------------------- ### win.guid.create Source: https://www.aardio.com/zh-cn/docs/library-reference/win/guid.html 生成一个新的唯一 GUID 结构体。 ```APIDOC ## win.guid.create() ### Description 创建一个新的 GUID 结构体并初始化为唯一值。 ### Returns - **winGuidObject** - 返回生成的唯一 GUID 对象。 ``` -------------------------------- ### webrpcjsonServerObject.rpc.run() Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rpc/jsonServer.html Starts the JSON-RPC server to begin responding to client requests. ```APIDOC ## webrpcjsonServerObject.rpc.run() ### Description Runs the JSON-RPC server to respond to user requests. ### Parameters - **$** (any, optional) - The first callback parameter for all callback functions whose names start with '$'. Defaults to the request object. ``` -------------------------------- ### tortoiseSvn.install.setup Source: https://www.aardio.com/zh-cn/docs/library-reference/tortoiseSvn/install.html 根据提供的下载地址下载并安装 TortoiseSVN。参数可省略。 ```APIDOC ## tortoiseSvn.install.setup(下载地址) ### Description 执行 TortoiseSVN 的下载与安装操作。参数可省略。 ### Parameters - **下载地址** (string) - Optional - 安装包的下载 URL ``` -------------------------------- ### win.guid Source: https://www.aardio.com/zh-cn/docs/library-reference/win/guid.html 创建或转换 GUID 结构体。支持传入 ProgID、CLSID 或 GUID 字符串,或通过参数初始化结构体字段。 ```APIDOC ## win.guid(input) ### Description 将字符串(ProgID, CLSID, GUID)转换为 GUID 结构体,或创建一个空的 GUID 结构体。 ### Parameters - **input** (string) - Optional - ProgID, CLSID, or GUID string. ### Returns - **winGuidObject** - 返回 GUID 结构体对象,失败返回 null。 ``` -------------------------------- ### winring0.InitializeOls Source: https://www.aardio.com/zh-cn/docs/library-reference/winring0/_.html 初始化并加载驱动程序。 ```APIDOC ## winring0.InitializeOls ### Description 加载驱动程序,成功返回 true。导入库时会自动调用该函数。 ### Signature `bool()` ``` -------------------------------- ### 处理 get peers 请求事件 Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/bt/dhtClient.html 通过 onGetPeers 事件处理收到的 get peers 请求,获取发现的 BT 资源 info hash 值。 ```aardio wsockBtDhtClientObject.onGetPeers = function(infoHash,ip,port){ /*收到 get peers 请求。 回调参数 @infoHash 为发现的 BT 资源 info hash 值。*/ } ``` -------------------------------- ### winGuidObject Source: https://www.aardio.com/zh-cn/docs/library-reference/win/guid.html GUID 结构体对象的方法与属性。 ```APIDOC ## winGuidObject ### Properties - **Data1** (INT) - **Data2** (WORD) - **Data3** (WORD) - **Data4** (string/array) ### Methods - **create()**: 初始化为唯一值。 - **hex()**: 转换为 16 进制格式字符串。 - **isNull()**: 判断是否为 GUID_NULL。 - **toProgId()**: 将 CLSID 转换为 ProgId 字符串。 - **toString(format)**: 转换为字符串,支持格式化参数或大括号/大小写控制。 - **unpack()**: 返回 11 个数值。 ``` -------------------------------- ### web.view.installRuntime(winform) Source: https://www.aardio.com/zh-cn/docs/library-reference/web/view/_.html 强制重装 WebView2 Runtime。 ```APIDOC ## web.view.installRuntime(winform) ### Description 重装 WebView2 Runtime。 ### Parameters - **winform** (object) - Required - 指定安装程序的所有者窗口。 ``` -------------------------------- ### win.guid.valid Source: https://www.aardio.com/zh-cn/docs/library-reference/win/guid.html 验证并转换 GUID 对象。 ```APIDOC ## win.guid.valid(obj) ### Description 判断参数是否为有效的 GUID 对象。如果参数是 ProgID, CLSID 或 GUID 字符串,则尝试转换。 ### Parameters - **obj** (any) - Optional - 待验证的 GUID 对象或字符串。 ### Returns - **winGuidObject** - 转换成功返回 GUID 对象,否则返回 null。 ``` -------------------------------- ### Socks5ServerAsyncObject.setUpstreamProxy() Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/socks5Server.html 设置上游代理服务器,支持在服务启动后动态修改。 ```APIDOC ## Socks5ServerAsyncObject.setUpstreamProxy(IP, 端口, 用户名, 密码) ### 描述 设置上游代理服务器。在调用 start 方法启动服务端之后,仍然可以调用此方法修改上游服务端地址。新的设置对下一次请求生效。 ### 参数 - **IP** (string) - 可选 - 上游代理 IP,或以 "socks5://ip:port" 格式指定 - **端口** (number) - 可选 - 上游代理端口,默认为 1080 - **用户名** (string) - 可选 - 上游代理用户名 - **密码** (string) - 可选 - 上游代理密码 ``` -------------------------------- ### 使用 process.adb 连接安卓设备并执行 shell 命令 Source: https://www.aardio.com/zh-cn/docs/examples/Automation/adb/adb.html 通过 process.adb.connecter 自动连接设备,并利用 process.adb.shell 执行命令后读取输出结果。 ```aardio //aardio 调用 adb 操作安卓手机 import win.ui; /*DSG{{*/ var winform = win.form(text="process.adb 扩展库 - 安卓手机扫码配对,无线调试";right=564;bottom=593;bgcolor=16777215) winform.add( edit={cls="edit";left=19;top=17;right=544;bottom=573;db=1;dl=1;dr=1;edge=1;hscroll=1;multiline=1;vscroll=1;z=1} ) /*}}*/ winform.show(); import process.adb.connecter; //自动连接安卓手机 if process.adb.connecter(){ //执行 shell 命令 var adb = process.adb.shell("ls"); var out = adb.readAll(); //读取进程输出,adb 是一个 process.popen 对象,请参考该库函数文档。 winform.edit.print(out); } else { winform.msgboxErr("连接失败,请输入正确端口") } win.loopMessage(); ``` -------------------------------- ### win.guid.fromString Source: https://www.aardio.com/zh-cn/docs/library-reference/win/guid.html 将字符串转换为 GUID 结构体。 ```APIDOC ## win.guid.fromString(str) ### Description 将符合 ProgID, CLSID 或 GUID 格式的字符串转换为 GUID 结构体。 ### Parameters - **str** (string) - Required - 待转换的字符串。 ### Returns - **winGuidObject** - 返回 GUID 结构体,失败返回 null。 ``` -------------------------------- ### wsock.tcp.simpleHttpServer.startUrl Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/simpleHttpServer.html 查找可用端口创建 HTTP 服务器线程,并返回完整 URL。 ```APIDOC ## wsock.tcp.simpleHttpServer.startUrl(path, documentRoot, app) ### Description 在 127.0.0.1 上查找可用端口启动 HTTP 服务器。如果服务器已启动,则直接返回现有 URL。 ### Parameters - **path** (string) - Optional - 请求目标文件的相对路径。 - **documentRoot** (string) - Optional - 网站根目录,默认为 "/"。 - **app** (function) - Optional - 处理 HTTP 请求的线程函数。 ``` -------------------------------- ### trackbarObject.setSel(start, end) Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/trackbar.html 设置跟踪条的选区范围。 ```APIDOC ## trackbarObject.setSel(start, end) ### Description 设置跟踪条的选区起始刻度和结束刻度。 ``` -------------------------------- ### pictureboxObject.width Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/picturebox.html Gets or sets the width of the control. ```APIDOC ## pictureboxObject.width ### Description Width of the control. ``` -------------------------------- ### wsock.tcp.simpleHttpServer.startSpaUrl Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/simpleHttpServer.html 启动 SPA 单页应用 HTTP 服务,并返回首页网址。 ```APIDOC ## wsock.tcp.simpleHttpServer.startSpaUrl(indexHtmlPath, documentBase, app) ### Description 启动 SPA 单页应用服务,自动设置 404 错误页指向首页路径。 ### Parameters - **indexHtmlPath** (string) - Required - SPA 单页应用首页路径。 - **documentBase** (string) - Optional - 指定网站根目录。 - **app** (function) - Optional - 处理 HTTP 请求的线程函数。 ``` -------------------------------- ### zlib.installer.asInvoker Source: https://www.aardio.com/zh-cn/docs/library-reference/zlib/installer.html 下载压缩包并以当前进程权限启动其中的安装程序。 ```APIDOC ## zlib.installer.asInvoker(appName, url, parameters, savePath, x86exe, x64exe, winform) ### Description 下载压缩包并以当前进程权限启动压缩包内的安装程序。返回 true 表示成功启动并关闭,返回 false 表示用户阻止了安装程序启动。 ### Parameters - **appName** (string) - 下载窗口标题显示的应用程序名 - **url** (string) - 下载地址 - **parameters** (string) - 运行安装程序的参数 (可选) - **savePath** (string) - 存储路径 (可选) - **x86exe** (string) - 安装包中32位安装程序相对路径 - **x64exe** (string) - 安装包中64位安装程序相对路径 (可选) - **winform** (object) - 指定父窗口 (可选) ``` -------------------------------- ### 初始化与调用企业微信 API Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rest/qywx.html 配置企业微信凭证并演示基础的 GET 请求与调试模式调用。 ```aardio //请先导入 web.rest.qywx 库然后再调用下面的代码 var qywx = web.rest.qywx(); //请指定企业微信的 corpid,corpsecret,后续所有的 token 获取、拼接、过期重试,它都会全自动处理 qywx.setAuth("YOUR_CORPID", "YOUR_CORPSECRET"); /* // (可选) 设置全局错误拦截,只要接口报错就会走到这里 qywx.onError = function(errcode, errmsg){ print("【全局拦截】API调用失败:", errcode, errmsg); } */ var wx = qywx.api(); /* 1. 因为网址路径叫 get,必须写为以 ["get"] 格式放到下标里避免被当成 HTTP 方法。 2. 最后的 .get(...) 才是真正的发起 HTTP GET 请求。 */ */ var user = qywx.user["get"].get(userid="*********") var result = wx.externalcontact.groupchat.list({ status_filter=0; limit=10; }) // debug 模式调用接口,同一个api每分钟不能超过5次 var result = wx.externalcontact.groupchat.list({ status_filter=0; limit=10; },{ debug = 1 //查询:https://open.work.weixin.qq.com/devtool/query }) if(result[["errcode"]]!==0){ print(result[["errcode"]],result[["errmsg"]]) } ``` -------------------------------- ### winex.mainWindows Source: https://www.aardio.com/zh-cn/docs/library-reference/winex/mainWindows.html 查找进程主窗口的函数,支持多种参数重载以适应不同的查找需求。 ```APIDOC ## winex.mainWindows(EXE文件名, true) ### 描述 查找并等待指定 EXE 运行进程的所有主窗口显示。 ### 返回值 返回表的键为进程 ID,值为包含窗口信息的表(包含 hwnd, title 等字段)。 ## winex.mainWindows() ### 描述 无参数调用时,返回所有可以找到主窗口的进程表。 ### 返回值 返回表的键为进程 ID,值为包含窗口信息的表(包含 hwnd, title, threadId, visible, main 字段)。 ## winex.mainWindows(进程) ### 描述 根据进程 ID 或 process 对象查找主窗口。 ### 返回值 找到则返回包含主窗口信息的表对象(包含 hwnd, title 字段),找不到则返回 null。 ## winex.mainWindows(进程, true) ### 描述 查找并等待指定进程显示主窗口。 ### 返回值 返回包含主窗口信息的表对象(包含 hwnd, title 字段)。 ``` -------------------------------- ### 使用 wsock.tcp.simpleHttpServer 下载文件 Source: https://www.aardio.com/zh-cn/docs/examples/Web/HTTPServer/response.loadcode.html 通过设置 documentRoot 限制访问范围,并利用 response.loadcode 处理文件下载请求。 ```aardio //下载文件 import console; import wsock.tcp.simpleHttpServer; //创建 HTTP 服务端,不指定端口时自动分配空闲端口 var server = wsock.tcp.simpleHttpServer("127.0.0.1",/*8081*/); //指定网站根目录,不允许下载根目录之外的文件 server.documentRoot = "~/examples/Graphics/"; //显示服务器地址 console.log( server.getUrl() ) //在浏览器打开服务器地址 raw.execute( server.getUrl() ); //运行 HTTP 服务端处理程序 server.run( function(response,request,session){ //处理请求,request.path 是客户端请求的文件路径。 if( request.path = "/test.jpg" ){ /* 如果参数是 *.aardio 则执行服务端代码。否则下载文件。 这个函数已经处理好所有事件,一般没必要自己重新去写个 HTTP 下载功能(工作量和难度都不小)。 */ response.loadcode("/.gdip.jpg"); /* 如果需要更多功能,例如重启,更换根目录等等, 请查看『扫码传文件』范例。 */ } else{ //自动支持服务端模板语法 https://www.aardio.com/zh-cn/docs/language-reference/templating/syntax.html loadcodex(`
/test.jpg `); } } ) ``` -------------------------------- ### winex.mainWindows.each Source: https://www.aardio.com/zh-cn/docs/library-reference/winex/mainWindows.html 用于遍历主窗口的迭代器函数。 ```APIDOC ## winex.mainWindows.each("EXE文件名", true) ### 描述 等待指定 EXE 运行进程的所有主窗口显示,然后遍历这些主窗口。 ### 迭代器返回参数 序号, 窗口句柄, 标题, 是否显示, 进程ID, 线程ID ## winex.mainWindows.each() ### 描述 遍历系统中所有主窗口。 ### 迭代器返回参数 序号, 窗口句柄, 标题, 是否显示, 进程ID, 线程ID ``` -------------------------------- ### editObject.text Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/edit.html Gets or sets the text content of the edit control. ```APIDOC ### editObject.text Gets or sets the text content of the edit control. Supports UTF8 or UTF16 strings. Setting to null converts to an empty string. Note that edit controls use CRLF ('\r\n') for line breaks. ``` -------------------------------- ### checkboxObject.checked Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/button.html Property to get or set the checked state of the checkbox. ```APIDOC ## checkboxObject.checked ### Description A boolean property representing whether the checkbox is currently in a checked state. ``` -------------------------------- ### win.ui.ctrl.atlax() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/atlax.html Creates an atlax control instance for hosting COM objects. ```APIDOC ## win.ui.ctrl.atlax() ### Description Creates a new atlax control instance. This control is used to host COM objects within an aardio window. ### Usage 1. Drag a 'custom' control onto the interface. 2. Set the control class name to 'atlax'. 3. Set the control's text property to the desired COM class name (e.g., 'InkEd.InkEdit'). ### Returns - **atlAxWinObject** - The created atlax control object. ``` -------------------------------- ### zlib.installer Source: https://www.aardio.com/zh-cn/docs/library-reference/zlib/installer.html 下载压缩包并以管理权限启动其中的安装程序。 ```APIDOC ## zlib.installer(appName, url, parameters, savePath, x86exe, x64exe, winform) ### Description 下载压缩包并以管理权限启动压缩包内的安装程序。返回 true 表示成功启动并关闭,返回 false 表示用户阻止了安装程序启动。 ### Parameters - **appName** (string) - 下载窗口标题显示的应用程序名 - **url** (string) - 下载地址 - **parameters** (string) - 运行安装程序的参数 (可选) - **savePath** (string) - 存储路径 (可选) - **x86exe** (string) - 安装包中32位安装程序相对路径 - **x64exe** (string) - 安装包中64位安装程序相对路径 (可选) - **winform** (object) - 指定父窗口 (可选) ``` -------------------------------- ### HttpSimpleServerObject.run() Source: https://www.aardio.com/zh-cn/docs/library-reference/wsock/tcp/simpleHttpServer.html Starts the HTTP server request processing loop. ```APIDOC ## HttpSimpleServerObject.run(httpProc, runArgs2) ### Description Starts the server and executes the provided callback function for incoming requests. The callback receives response, request, session, and optional arguments. ``` -------------------------------- ### 使用 startUrl 启动多线程 HTTP 服务端 Source: https://www.aardio.com/zh-cn/docs/examples/Web/HTTPServer/simpleHttpServer.startUrl.html 通过 startUrl 在界面线程中启动后台 HTTP 服务,自动分配端口并处理生命周期。适用于在软件内嵌 HTTP 服务。 ```aardio //最简多线程服务端 import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=759;bottom=469) winform.add() /*}}*/ //HTTP 服务端开发指南: https://www.aardio.com/zh-cn/docs/guide/quickstart/web-server.html import wsock.tcp.simpleHttpServer; /* wsock.tcp.simpleHttpServer 用于创建多线程 HTTP 服务器。 默认的服务器线程是阻塞的,所以不要在窗口界面线程启动服务器线程。 wsock.tcp.simpleHttpServer.mainThread 则用于界面线程创建后台线程启动服务器, 好处是不会阻塞界面。 wsock.tcp.simpleHttpServer.startUrl() 函数 实际上就是调用 wsock.tcp.simpleHttpServer.mainThread 这个函数在界面线程内启动线程并返回访问地址,自动分配空闲端口,自动创建服务器线程, 并在界面线程退出前自动退出服务器线程,最适合用于创建软件内嵌的 HTTP 服务端。 */ //服务端 aardio 支持模板语法: https://www.aardio.com/zh-cn/docs/language-reference/templating/syntax.html var url = wsock.tcp.simpleHttpServer.startUrl("/.www/main.aardio");//参数支持 aardio 工程嵌入资源目录路径 //上面的函数可以重复调用,不会重复创建新的 HTTP 服务器端。 import web.form; var wb = web.form(winform); //用浏览器组件打开网页试试 wb.go(url); winform.show(); win.loopMessage(); ``` -------------------------------- ### winform.onEnterSizeMove Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/_.html Triggered when the user starts dragging or resizing the window. ```aardio winform.onEnterSizeMove = function(){ /*开始拖动触发此函数*/ } ``` -------------------------------- ### pictureboxObject.value Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/picturebox.html Gets or sets the control image. This is an alias for the image property. ```APIDOC ## pictureboxObject.value ### Description Control image. Alias for the image property. ``` -------------------------------- ### win.ui.simpleWindow3 Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/simpleWindow3.html 构造函数,用于为指定的无边框窗口添加渐变背景标题栏及相关控制功能。 ```APIDOC ## win.ui.simpleWindow3(窗体对象,字体大小,按钮宽度,按钮高度,标题栏高度,背景色,前景色) ### 描述 为指定的无边框窗口添加渐变背景的标题栏,并自动添加拖动边框、窗口阴影及控制按钮。 ### 参数 - **窗体对象** (object) - 目标无边框窗口对象 - **字体大小** (number) - 可选,标题栏按钮字体大小(像素) - **按钮宽度** (number) - 可选,关闭等按钮宽度 - **按钮高度** (number) - 可选,关闭等按钮高度 - **标题栏高度** (number) - 可选,标题栏高度 - **背景色** (number) - 可选,渐变顶部颜色 - **前景色** (number) - 可选,渐变底部颜色 ``` -------------------------------- ### 使用 NewWindow2 事件接管网页弹窗 Source: https://www.aardio.com/zh-cn/docs/examples/WebUI/web.form/Feature/NewWindow2/openproxy.html 通过设置 wb.NewWindow2 回调函数并返回 wb.openproxy,可以拦截网页中尝试打开新窗口的操作。 ```aardio import win.ui; import web.form; /*DSG{{*/ var winform = win.form(text="NewWindow2 事件接管网页弹窗";right=757;bottom=467;scroll=1) winform.add() /*}}*/ //创建web窗体 var wb = web.form( winform ); wb.noScriptErr = true; //禁止打开新窗口 wb.NewWindow2 = function( ppDisp, Cancel) { return wb.openproxy } //打开目标网站 wb.go("http://www.example.com/") //显示窗体 winform.show() wb.wait("");//等待指定网址,可以使用模式匹配语法 //进入消息循环 win.loopMessage(); return winform,wb; ``` -------------------------------- ### webRestILinkClientObject.get Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rest/iLinkClient.html Performs a GET request to the specified URL with optional parameters. ```APIDOC ## webRestILinkClientObject.get(网址, 参数表) ### Description Sends a GET request to the specified URL. Parameters provided as a table are automatically converted to URL query parameters. ### Returns - Success: Returns the data. - Failure: Returns null, error message, and error code. ``` -------------------------------- ### wb.NewWindow3 事件 Source: https://www.aardio.com/zh-cn/docs/library-reference/web/form/_.html 新窗口创建事件,支持 URL 上下文。 ```aardio wb.NewWindow3 = function(ppDisp,cancel,dwFlags,bstrUrlContext,bstrUrl ) { ..thread.invoke( function(url){ /*建议创建线程调用默认浏览器打开新窗口*/ },bstrUrl ) return ppDisp,true; }; ``` -------------------------------- ### uiCtrlPlusObject.startProgress Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/plus.html Starts the progress bar animation and displays the progress bar. ```APIDOC ## uiCtrlPlusObject.startProgress(interval, step) ### Description Starts the progress bar animation. Requires setProgressRange to be called beforehand and a foreground color or image to be specified. ### Parameters - **interval** (number) - Optional - Interval in milliseconds. - **step** (number) - Optional - Progress increment per step. ``` -------------------------------- ### editObject.getSel Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/edit.html Retrieves the start and end positions of the current text selection. ```APIDOC ## editObject.getSel() ### Description Returns the start and end positions of the selection. The first character position is 1. If only one value is returned, it indicates no selection and represents the caret position. ### Returns - **start** (number) - The starting position of the selection. - **end** (number) - The ending position of the selection. ``` -------------------------------- ### win.ui.simpleWindow2() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/simpleWindow2.html 构造函数,用于为指定的无边框窗口添加简单的标题栏。 ```APIDOC ## win.ui.simpleWindow2(窗体对象,字体大小,按钮宽度,按钮高度,右边距,上边距) ### Description 为参数@1指定的无边框窗口添加简单的标题栏。标题栏默认透明,建议在标题栏拖一个bk控件设置背景色。 ### Parameters - **窗体对象** (winform) - Required - 要添加标题栏的无边框窗口对象 - **字体大小** (number) - Optional - 标题栏按钮字体大小(像素) - **按钮宽度** (number) - Optional - 关闭等按钮宽度 - **按钮高度** (number) - Optional - 关闭等按钮高度 - **右边距** (number) - Optional - 标题栏右边距 - **上边距** (number) - Optional - 标题栏上边距 ``` -------------------------------- ### web.socket.server.start Source: https://www.aardio.com/zh-cn/docs/library-reference/web/socket/server.html 启动单线程异步 WebSocket 服务端。 ```APIDOC ## web.socket.server.start(IP, 端口, 请求队列大小) ### Description 启动单线程异步 WebSocket 服务端。如果不指定 IP,默认监听 0.0.0.0。端口为 0 或省略时,将自动查找 1025 后的空闲端口。 ### Parameters - **IP** (string) - 可选 - 监听的 IP 地址,默认为 "0.0.0.0"。 - **端口** (number) - 可选 - 监听的端口号。 - **请求队列大小** (number) - 可选 - 请求队列长度。 ### Response - **success** (boolean) - 成功返回 true,失败返回 null。 ``` -------------------------------- ### webRestGradioObject.getInfo Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rest/gradioClient.html Sends a GET request to the '/info' endpoint to retrieve available endpoints. ```APIDOC ## GET /info ### Description Retrieves information about available custom endpoints, including named and unnamed endpoints. ### Method GET ### Endpoint /info ### Response #### Success Response (200) - **named_endpoints** (table) - Map of named endpoints. - **unnamed_endpoints** (table) - Map of unnamed endpoints indexed by number. ``` -------------------------------- ### win.util.desktop() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/util/desktop.html 创建并返回一个虚拟桌面管理对象 (virDesktopMgrObject)。 ```APIDOC ### win.util.desktop() 返回一个用于管理虚拟桌面的 virDesktopMgrObject 对象。 ``` -------------------------------- ### webRestGradioObject.getConfig Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rest/gradioClient.html Sends a GET request to the '/config' endpoint to retrieve the configuration object. ```APIDOC ## GET /config ### Description Retrieves the configuration object from the Gradio API. ### Method GET ### Endpoint /config ### Response #### Success Response (200) - **config** (table) - The configuration object returned by the server. #### Error Response - **error** (string) - Error message if the request fails. ``` -------------------------------- ### uiCtrlPlusObject.startAnimation Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/plus.html Starts an animation timer that triggers the onAnimation event and redraws the control. ```APIDOC ## uiCtrlPlusObject.startAnimation(interval, beginning, change, duration) ### Description Starts an animation timer, immediately running the animation once and then periodically executing the onAnimation callback and redrawing the control. ### Parameters - **interval** (number) - Required - Animation interval in milliseconds. - **beginning** (number) - Optional - Initial state value (default 0). - **change** (number) - Optional - State value after animation completion. - **duration** (number) - Optional - Animation duration. ``` -------------------------------- ### win.ui.simpleWindow() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/simpleWindow.html 构造函数,用于为指定的无边框窗口添加简单的标题栏。 ```APIDOC ## win.ui.simpleWindow(窗体对象, 字体大小, 按钮宽度, 按钮高度, 标题栏高度) ### Description 为指定的无边框窗口添加简单的透明标题栏。建议在界面初始化完成且标题区背景色更新后调用此构造函数。 ### Parameters - **窗体对象** (winform) - Required - 需要添加标题栏的无边框窗口对象。 - **字体大小** (number) - Optional - 标题栏按钮字体大小(像素)。 - **按钮宽度** (number) - Optional - 关闭等按钮的宽度。 - **按钮高度** (number) - Optional - 关闭等按钮的高度。 - **标题栏高度** (number) - Optional - 标题栏的高度。 ``` -------------------------------- ### win.util.tray() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/util/tray.html 创建并返回一个托盘图标对象。 ```APIDOC ## win.util.tray(主窗体,图标,提示信息) ### 说明 创建托盘图标,必须指定窗体对象。图标参数可指定图标ID、句柄、图标数据或图标路径,默认为窗体图标。提示信息为鼠标悬停时显示的文本。 ### 参数 - **主窗体** (object) - 必需 - 关联的窗体对象 - **图标** (any) - 可选 - 图标ID、句柄、数据或路径 - **提示信息** (string) - 可选 - 鼠标悬停提示文本 ``` -------------------------------- ### webRestGradioObject.getQueueStatus Source: https://www.aardio.com/zh-cn/docs/library-reference/web/rest/gradioClient.html Sends a GET request to the '/queue/status' endpoint to retrieve the current queue status. ```APIDOC ## GET /queue/status ### Description Retrieves the current status of the task queue. ### Method GET ### Endpoint /queue/status ### Response #### Success Response (200) - **status** (table) - The queue status object. ``` -------------------------------- ### 使用 web.rest 获取圆周率 Source: https://www.aardio.com/zh-cn/docs/examples/Web/REST/pi.html 通过 web.rest.jsonLiteClient 访问 pi.delivery API,并使用 get 方法传递查询参数。 ```aardio //用 web.rest 客户端调用 HTTP API - 获取圆周率 import console.int; import web.rest.jsonLiteClient; var http = web.rest.jsonLiteClient(); //可查询前 100 万亿位的圆周率,也是目前最长的在线可用圆周率数据库之一 var delivery = http.api("https://api.pi.delivery/v1/pi"); //查询圆周率,参数指定一个表对象(table),单个表参数外层的 {} 可以省略不写 var ret = delivery.get( start=1, //从第 1 位开始 numberOfDigits=100 //返回 100 位圆周率 ) //显示圆周率 console.log("3."+ ret.content) ``` -------------------------------- ### wb.NewWindow2 事件 Source: https://www.aardio.com/zh-cn/docs/library-reference/web/form/_.html 新窗口创建事件。 ```aardio wb.NewWindow2 = function( ppDisp, Cancel) { owner.go( owner.translateUrl ) return ppDisp, true; /*return wb.openproxy; */ }; ``` -------------------------------- ### 使用 com.CreateObject 创建并操作 COM 对象 Source: https://www.aardio.com/zh-cn/docs/examples/COM/GettingStarted/CreateObject.html 通过 com.CreateObject 实例化 COM 组件,并使用 com.each 遍历集合或 com.tlbDoc 查看类型信息。 ```aardio //COM 接口 - 创建对象 import com; import console; //参考文档: https://www.aardio.com/zh-cn/docs/library-guide/builtin/com/com.html //创建 COM 对象,注意 COM 有关的函数通常首字母大写 var fs = com.CreateObject("Scripting.FileSystemObject"); //使用 COM 对象 var dir = fs.GetFolder( io.fullpath("/") ); //遍历COM对象成员 for index,file in com.each(dir.Files) { console.log(file.path); } console.more(); //查看 COM 对象成员 console.dump( com.DumpTypeInfo(dir) ); //上面的函数可以简写为 console.dump( dir ); //输出更详细的 COM 对象类型库信息 import com.tlbDoc; com.tlbDoc.dump( dir );//用 com.tlbDoc(dir) 可以得到输出的文档 console.pause(); ``` -------------------------------- ### win.ui.ctrl.bkplus() Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/bkplus.html 创建 bkplus 控件实例。该控件为无窗口控件(无句柄),仅用于背景贴图,不支持交互事件。 ```APIDOC ## win.ui.ctrl.bkplus() ### Description 创建一个无句柄的背景贴图控件,基于 GDI+,支持透明 PNG 图像。适合显示静态、不会频繁变动的图像或颜色。 ### Returns - **winuictrlbkplusObject** - 返回 bkplus 控件对象。 ``` -------------------------------- ### comboboxObject.selectString Source: https://www.aardio.com/zh-cn/docs/library-reference/win/ui/ctrl/combobox.html Searches for and selects an item based on a text prefix, starting from a specified index. ```APIDOC ## comboboxObject.selectString(prefix, startIndex) ### Description Searches for and selects an item based on a text prefix, starting from a specified index. The default start index is 0. ``` -------------------------------- ### WebView2 模拟手机设备与 SOCKS5 代理配置 Source: https://www.aardio.com/zh-cn/docs/examples/WebUI/web.view/OtherApps/socks5.html 通过 wsock.tcp.socks5Server 启动本地代理,并配置 web.view 的 startArguments 和 CDP 接口实现移动端模拟。 ```aardio //WebView2 模拟手机设备 + 动态设置 SOCKS5 代理服务器 import fonts.fontAwesome; import web.view; import win.ui; /*DSG{{*/ var winform = win.form(text="SOCKS5 浏览器";right=959;bottom=640;bgcolor=0xFFFFFF) winform.add( btnGo={cls="plus";left=895;top=7;right=950;bottom=33;color=0x3C3C3C;disabled=1;dr=1;dt=1;font=LOGFONT(h=-13);iconStyle={font=LOGFONT(h=-15;name='FontAwesome')};iconText='\uF1D8';notify=1;z=4}; btnRefresh={cls="plus";left=241;top=7;right=271;bottom=33;color=0x3C3C3C;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={font=LOGFONT(h=-13;name='FontAwesome')};iconText='\uF021';notify=1;z=6}; comboProxy={cls="combobox";left=50;top=9;right=240;bottom=33;dl=1;dt=1;edge=1;items={};mode="dropdown";z=2}; custom={cls="custom";left=0;top=40;right=942;bottom=640;db=1;dl=1;dr=1;dt=1;z=1}; editUrl={cls="plus";left=489;top=7;right=893;bottom=33;align="right";border={bottom=1;color=0xFF969696};disabled=1;dr=1;dt=1;editable="edit";font=LOGFONT(h=-13);notify=1;textPadding={left=5;top=3;bottom=3};z=3}; labelProxy={cls="static";text="代理:";left=8;top=12;right=48;bottom=28;dl=1;dt=1;transparent=1;z=5}; labelStatus={cls="static";text="正在搜索代理...";left=277;top=12;right=441;bottom=28;dl=1;dt=1;transparent=1;z=7} ) /*}}*/ // 创建 SOCKS5 中转代理服务器 import wsock.tcp.socks5Server; var socks5Server = wsock.tcp.socks5Server.async("127.0.0.1",0); socks5Server.start(); // 创建 WebView2 控件,模拟手机浏览器 var wb = web.view(winform.custom,{ startArguments = { acceptLang = "zh-CN"; userAgent = "Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.166"; proxyServer = socks5Server.getUrl();//使用 SOCKS5 代理 }; userDataDir = _STUDIO_INVOKED ? io.appData("/aardio/webview2/user-data/ide/socks5-browser") }) // 启用 CDP 的 Emulation 域,模拟手机设备 wb.cdp("Emulation.enable"); wb.cdp("Emulation.setDeviceMetricsOverride", { mobile = true; }); // 设置移动设备 HTTP 请求头 wb.cdp("Network.enable"); wb.cdp("Network.setExtraHTTPHeaders", { headers = { ["Sec-CH-UA-Mobile"] = "?1"; ["Sec-CH-UA-Platform"] = '"Android"'; } }); wb.onDocumentComplete = function(url){ if(!string.find(url,"^