Run an app (app.run)
Declaration
status = app.run(bid)
Parameters
- bid
String. App bundle identifier. You can find it inXXT App -> More -> App
List.
Returns
- status
Integer. 0 on success, non-zero on failure.
Notes
- If this function does not work well in your script, try
runApp
instead.
Example
-- Open built-in Weather app, then quit
local r = app.run("com.apple.weather") -- bundle id can be found in `XXT App -> More -> App List`
sys.msleep(10 * 1000) -- wait 10 seconds
if r == 0 then
app.close("com.apple.weather") -- terminate
else
sys.alert("Launch failed", 3)
end
Note: uses non-chapter APIs sys.msleep
and sys.alert
.