### find Example Source: http://autojs.cc/v8/automator/selector.html Example of using find to get a collection of all matching UI elements and checking if the collection is empty. ```javascript var c = className("AbsListView").find(); if(!c.empty()){ toast("找到啦"); }else{ toast("没找到╭(╯^╰)╮"); } ``` -------------------------------- ### Example: Opening an image file with app.intent Source: http://autojs.cc/v8/app.html This example demonstrates how to construct an Intent to view a PNG image file using app.intent and then start the activity. ```javascript //打开应用来查看图片文件 var i = app.intent({ action: "VIEW", type: "image/png", data: "file:///sdcard/1.png" }); context.startActivity(i); ``` -------------------------------- ### Get System Apps Source: http://autojs.cc/v8/app.html Example of how to get a list of system applications and specify the information to be returned, such as meta_data. ```javascript // 获取系统app let apps = $app.getInstalledApps({ get: ['meta_data'], match: ['system_only'] }); console.log(apps); ``` -------------------------------- ### $util.format Example 3 Source: http://autojs.cc/v8/util.html Example showing the behavior when the first argument is not a string. ```javascript $util.format(1, 2, 3); // '1 2 3' ``` -------------------------------- ### $util.format Example 1 Source: http://autojs.cc/v8/util.html Example demonstrating how placeholders are not replaced if no corresponding argument is provided. ```javascript $util.format('%s:%s', 'foo'); // Returns: 'foo:%s' ``` -------------------------------- ### Input Control Hint Example Source: http://autojs.cc/v8/ui/basic.html Example of an input field with a hint. ```javascript "ui"; ui.layout( ); ``` -------------------------------- ### on example Source: http://autojs.cc/v8/events.html Basic example of adding an event listener. ```javascript server.on('connection', (stream) => { console.log('有连接!'); }); ``` -------------------------------- ### Button Control Example Source: http://autojs.cc/v8/ui/basic.html Example of a colored button using a predefined AppCompat style. ```xml