### Get Application Bundle Path Source: https://www.touchsprite.com/helpdoc Returns the installation path of a specified application on the device. ```Lua appBundlePath(appName) ``` -------------------------------- ### Get Installed Applications Source: https://www.touchsprite.com/helpdoc Retrieves a list of all applications currently installed on the device. ```Lua getInstalledApps() ``` -------------------------------- ### Install Application (Android) Source: https://www.touchsprite.com/helpdoc Installs an application from an APK file. This function is only supported on Android devices. ```Lua install(filePath) ``` -------------------------------- ### Install Application (iOS) Source: https://www.touchsprite.com/helpdoc Installs an application from an IPA file. This function is only supported on iOS devices. ```Lua ipaInstall(filePath) ``` -------------------------------- ### Run Application Source: https://www.touchsprite.com/helpdoc Launches a specified application on the device. This can be used to start games, utilities, or other apps. ```Lua runApp(appName) ``` -------------------------------- ### Query if Application is Installed (Android) Source: https://www.touchsprite.com/helpdoc Checks if a specific application is installed on the device using its package name. This function is only supported on Android devices. ```Lua isInstalledApk(packageName) ``` -------------------------------- ### Get Device Process List Source: https://www.touchsprite.com/helpdoc Retrieves a list of all currently running processes on the device. ```Lua getProcess() ``` -------------------------------- ### Get Application Data Path Source: https://www.touchsprite.com/helpdoc Returns the path to the data directory for a specified application. ```Lua appDataPath(appName) ``` -------------------------------- ### Get Screen Brightness Source: https://www.touchsprite.com/helpdoc Retrieves the current screen brightness level. ```Lua getBacklightLevel() ``` -------------------------------- ### Get Device Name Source: https://www.touchsprite.com/helpdoc Retrieves the current name of the device as displayed in system settings. ```Lua getDeviceName() ``` -------------------------------- ### Get Client File Path Source: https://www.touchsprite.com/helpdoc Returns the path to the directory where TouchSprite stores its client-related files. ```Lua userPath() ``` -------------------------------- ### Get Application Information (Android) Source: https://www.touchsprite.com/helpdoc Retrieves detailed information about a specified application. This function is only supported on Android devices. ```Lua getAppInfo(packageName) ``` -------------------------------- ### Get Device Type Source: https://www.touchsprite.com/helpdoc Retrieves the type of the device (e.g., iPhone, iPad). ```Lua getDeviceType() ``` -------------------------------- ### Get VPN Status Source: https://www.touchsprite.com/helpdoc Retrieves the current connection status of the VPN. ```Lua getVPNStatus() ``` -------------------------------- ### Get Device Memory Information Source: https://www.touchsprite.com/helpdoc Retrieves information about the device's memory usage, including total and available memory. ```Lua getMemoryInfo() ``` -------------------------------- ### Get Engine and OS Versions Source: https://www.touchsprite.com/helpdoc Retrieves the version number of the TouchSprite engine and the device's operating system. ```Lua getTSVer() getOSVer() ``` -------------------------------- ### Get Device Operating System Type Source: https://www.touchsprite.com/helpdoc Retrieves the type of the device's operating system (e.g., iOS, Android). ```Lua getOSType() ``` -------------------------------- ### Get Current Input Method (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the package name of the currently active input method. This is specific to Android devices. ```Lua getInPutMethod() ``` -------------------------------- ### Get CPU Type (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the CPU model of the device. This function is only supported on Android devices. ```Lua getCPUType() ``` -------------------------------- ### Get Device Alias (Enterprise Edition) Source: https://www.touchsprite.com/helpdoc Retrieves the device alias, which is a custom name for the device. This function is only available in the enterprise edition. ```Lua getDeviceAlias() ``` -------------------------------- ### Get TouchSprite Device ID Source: https://www.touchsprite.com/helpdoc Retrieves the unique device identifier assigned by TouchSprite. ```Lua getDeviceID() ``` -------------------------------- ### Get Foreground Application Bundle ID Source: https://www.touchsprite.com/helpdoc Retrieves the bundle identifier of the application currently in the foreground. This is useful for identifying the active app. ```Lua frontAppBid() ``` -------------------------------- ### Get Screen DPI and Pixel Density (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the Dots Per Inch (DPI) and pixel density of the device's screen. This function is only supported on Android devices. ```Lua getDPI() ``` -------------------------------- ### Get Device IMEI (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the International Mobile Equipment Identity (IMEI) of the device. This function is only supported on Android devices. ```Lua getIMEI() ``` -------------------------------- ### Get Device UUID (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the Universally Unique Identifier (UUID) of the device. This function is only supported on Android devices. ```Lua getUUID() ``` -------------------------------- ### Get Device Brand (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the brand name of the device (e.g., Samsung, Google). This function is only supported on Android devices. ```Lua getDeviceBrand() ``` -------------------------------- ### Get SD Card Path (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the file path to the device's SD card, if available. This function is only supported on Android devices. ```Lua getSDCardPath() ``` -------------------------------- ### Get Current Script Runtime Permissions (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the runtime permissions granted to the currently executing script. This function is only supported on Android devices. ```Lua getRunningAccess() ``` -------------------------------- ### Get Network IP Address (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the IP address assigned to the device on the current network. This function is only supported on Android devices. ```Lua getNetworkIP() ``` -------------------------------- ### Get TouchSprite Account ID (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the TouchSprite account ID associated with the device. This function is only supported on Android devices. ```Lua getTSAccountID() ``` -------------------------------- ### Get Device Model (Android) Source: https://www.touchsprite.com/helpdoc Retrieves the specific model name of the device (e.g., Galaxy S21, Pixel 6). This function is only supported on Android devices. ```Lua getDeviceModel() ``` -------------------------------- ### Switch to Application (Android) Source: https://www.touchsprite.com/helpdoc Brings a specified application to the foreground. This function is only supported on Android devices. ```Lua switchApp(packageName) ``` -------------------------------- ### Open URL Source: https://www.touchsprite.com/helpdoc Opens a given URL in the device's default web browser or appropriate application. ```Lua openURL(url) ``` -------------------------------- ### Script UI Creation with JSON Source: https://www.touchsprite.com/helpdoc Defines how to create user interfaces for scripts using JSON data to describe layout and controls. ```Lua showUI(jsonConfig) -- Example JSON structure: -- { -- "type": "window", -- "title": "My UI", -- "width": 300, "height": 200, -- "controls": [ -- { "type": "label", "text": "Hello, World!", "x": 10, "y": 10 } -- ] -- } ``` -------------------------------- ### Connect to Wi-Fi Source: https://www.touchsprite.com/helpdoc Connects the device to a specified Wi-Fi network. Requires network SSID and password. ```Lua connectToWifi(ssid, password) ``` -------------------------------- ### Save Video to Album (Android Command) Source: https://www.touchsprite.com/helpdoc A command-line equivalent for saving video files to the Android media gallery. ```Shell 命令: 安卓视频存入相册 ``` -------------------------------- ### Simulate Home Button Press Source: https://www.touchsprite.com/helpdoc Simulates a press of the device's Home button, returning the user to the main screen. ```Lua pressHomeKey() ``` -------------------------------- ### Execute System Commands Source: https://www.touchsprite.com/helpdoc Executes various system-level commands, including respringing, powering off, rebooting, and file operations. ```Lua os.execute("respring") -- iOS only os.execute("poweroff") -- iOS only os.execute("reboot") os.execute("clearCache") -- iOS only delFile(path) unzip(zipPath, destPath) movefile(srcPath, destPath) copyfile(srcPath, destPath) ``` -------------------------------- ### Play Audio Source: https://www.touchsprite.com/helpdoc Plays an audio file on the device. ```Lua playAudio(filePath) ``` -------------------------------- ### Text and Input Functions Source: https://www.touchsprite.com/helpdoc Functions for handling text input, keyboard simulation, and UTF-8 encoding. ```APIDOC ## Text and Input Functions ### Description Functions for handling text input, keyboard simulation, and UTF-8 encoding. ### Functions - **inputText(text)**: Input a string of text. - **switchTSInputMethod()**: Switch to the TouchSprite input method (Android only). - **getInPutMethod()**: Get the current input method package name (Android only). - **pressHomeKey()**: Simulate pressing the Home button. - **doublePressHomeKey()**: Simulate double-pressing the Home button (iOS only). - **keyDown(keyCode)**: Simulate a key press (iOS only). - **keyUp(keyCode)**: Simulate a key release (iOS only). - **[Android Physical Key Simulation]**: Simulate Android physical keys (Android only). - **utf8.char(sequence)**: Convert an integer sequence to a string. - **utf8.codes(str)**: Get the character codes of a string. - **utf8.codepoint(str, i)**: Get the codepoint of a character at a specific position. - **utf8.len(str)**: Count the number of characters in a string. - **utf8.offset(str, n)**: Get the byte offset of the nth character. ``` -------------------------------- ### Application Management Functions Source: https://www.touchsprite.com/helpdoc Functions for managing applications on the device, including running, closing, checking status, and installation/uninstallation. ```APIDOC ## Application Management Functions ### Description Functions for managing applications on the device. ### Functions - **runApp(bundleId)**: Run an application. - **closeApp(bundleId)**: Close an application. - **isFrontApp(bundleId)**: Check if a specific application is in the foreground. - **frontAppBid()**: Get the bundle ID of the foreground application. - **appBundlePath(bundleId)**: Get the installation path of an application. - **appDataPath(bundleId)**: Get the data path of an application. - **appIsRunning(bundleId)**: Check if an application is running. - **openURL(url)**: Open a network address. - **ipaInstall(ipaPath)**: Install an application from an IPA file (iOS only). - **ipaUninstall(bundleId)**: Uninstall an application (iOS only). - **install(apkPath)**: Install an application (Android only). - **uninstallApp(bundleId)**: Uninstall an application (Android only). - **getInstalledApps()**: Get a list of installed applications. - **isInstalledApk(bundleId)**: Check if an application is installed (Android only). - **cleanApp(bundleId)**: Clean application data (Android only). - **switchApp(bundleId)**: Switch to a specified application (Android only). - **closeAllApp()**: Close all background applications (Android only). - **getAppInfo(bundleId)**: Get information about a specific application (Android only). ``` -------------------------------- ### Floating Window UI Functions Source: https://www.touchsprite.com/helpdoc Functions for creating and managing floating windows and their elements (text views, image views, buttons). ```Lua fwShowWnd(wndName) fwShowTextView(wndName, viewName, x, y, w, h, text) fwShowImageView(wndName, viewName, x, y, w, h, imagePath) fwCloseView(wndName, viewName) fwCloseWnd(wndName) fwGetWndPos(wndName) fwShowButton(wndName, btnName, x, y, w, h, title) fwGetPressedButton(wndName) ``` -------------------------------- ### Touch Input Functions Source: https://www.touchsprite.com/helpdoc Functions for simulating touch input, including presses, moves, and multi-touch gestures. ```APIDOC ## Touch Input Functions ### Description Functions for simulating touch input, including presses, moves, and multi-touch gestures. ### Functions - **touchDown(x, y)**: Simulate a touch press at specified coordinates. - **touchUp(x, y)**: Simulate a touch release at specified coordinates. - **touchMove(x, y)**: Simulate a touch move to specified coordinates. - **catchTouchPoint()**: Get the coordinates of a user's touch point. - **touchInputDown(x, y)**: Simulate a touch press (Android only). - **touchInputMove(x, y)**: Simulate a touch move (Android only). - **touchInputUp(x, y)**: Simulate a touch release (Android only). - **[Encapsulated Touch Functions]**: Functions for encapsulated touch operations. - **[Continuous Swipe]**: Functions for performing continuous swipe gestures. - **[Precise Swipe]**: Functions for performing precise swipe gestures. - **[Multi-touch]**: Functions for simulating multi-touch gestures. - **[Click]**: Functions for simulating clicks. - **[Square Involute]**: Functions for square involute gestures. - **[Circular Involute]**: Functions for circular involute gestures. - **[Android Click Failure]**: Workaround for Android click failures. ``` -------------------------------- ### Floating Window Functions Source: https://www.touchsprite.com/helpdoc Functions for creating and managing floating windows and UI elements within them. ```APIDOC ## Floating Window Functions ### Description Functions for creating and managing floating windows and UI elements within them. ### Functions - **fwShowWnd(windowConfig)**: Show a floating window. - **fwShowTextView(config)**: Show a text view within a floating window. - **fwShowImageView(config)**: Show an image view within a floating window. - **fwCloseView(viewId)**: Close a specific view within a floating window. - **fwCloseWnd(windowId)**: Close a floating window. - **fwGetWndPos(windowId)**: Get the position of a floating window. - **fwShowButton(config)**: Show a button within a floating window. - **fwGetPressedButton()**: Get information about a pressed button event. ``` -------------------------------- ### Simulate Keyboard Input (iOS) Source: https://www.touchsprite.com/helpdoc Simulates key presses and releases on a virtual keyboard. This function is only supported on iOS devices. ```Lua keyDown(key) keyUp(key) ``` -------------------------------- ### Set Screen Brightness Source: https://www.touchsprite.com/helpdoc Adjusts the screen brightness level. The value should be between 0.0 and 1.0. ```Lua setBacklightLevel(level) ``` -------------------------------- ### Identify TouchSprite Product Type Source: https://www.touchsprite.com/helpdoc Determines the specific type or version of the TouchSprite product currently in use. ```Lua whoAmI() ``` -------------------------------- ### Read/Write Clipboard Source: https://www.touchsprite.com/helpdoc Functions for reading data from and writing data to the system clipboard. ```Lua writePasteboard(content) readPasteboard() ``` -------------------------------- ### Check if Application is Running Source: https://www.touchsprite.com/helpdoc Checks whether a specified application is currently running on the device. ```Lua appIsRunning(appName) ``` -------------------------------- ### Simulate Android Physical Key Press Source: https://www.touchsprite.com/helpdoc Simulates the pressing of a physical key on an Android device. This function is only supported on Android devices. ```Lua androidPhysicalKey(keyCode) ``` -------------------------------- ### Set Device Volume Source: https://www.touchsprite.com/helpdoc Adjusts the device's system volume level. ```Lua setVolumeLevel(level) ``` -------------------------------- ### Close Application Source: https://www.touchsprite.com/helpdoc Terminates a running application. This is useful for freeing up resources or ensuring a clean state. ```Lua closeApp(appName) ``` -------------------------------- ### Input Text Function Source: https://www.touchsprite.com/helpdoc Simulates text input. This function is essential for automating text entry in applications. ```Lua inputText(str) ``` -------------------------------- ### Image and Color Functions Source: https://www.touchsprite.com/helpdoc Functions for image processing, color detection, and screen capturing. ```APIDOC ## Image and Color Functions ### Description Functions for image processing, color detection, and screen capturing. ### Functions - **getScreenSize()**: Get the screen resolution. - **getDisplaySize()**: Get the device resolution excluding virtual buttons (Android only). - **getStatusBarHeight()**: Get the status bar height (Android only). - **setScreenScale(scale)**: Scale screen coordinates. - **keepScreen(on)**: Keep the screen on or off. - **getColor(x, y)**: Get the color value of a pixel at specified coordinates. - **getColorRGB(x, y)**: Get the RGB color value of a pixel at specified coordinates. - **findColorInRegionFuzzy(region, color)**: Fuzzy find a color within a specified region. - **findImageInRegionFuzzy(region, imagePath)**: Fuzzy find an image within a specified region. - **findMultiColorInRegionFuzzy(region, colors)**: Fuzzy find multiple colors within a specified region. - **findMultiColorInRegionFuzzyExt(region, colors, similarity)**: Advanced fuzzy find for multiple colors within a specified region. - **findImage(region, imagePath)**: Advanced find for an image within a specified region (iOS only). - **snapshot(x, y, width, height)**: Capture a screenshot of a specified region. - **imageOperMerge(imagePath1, imagePath2, outputPath)**: Merge two images. ``` -------------------------------- ### File Management Functions Source: https://www.touchsprite.com/helpdoc Functions for managing files on the device, including compression, decompression, and file operations. ```APIDOC ## File Management Functions ### Description Functions for managing files on the device. ### Functions - **unzip(zipPath, destPath)**: Decompress a zip file (Android only). - **zip(sourcePath, zipPath)**: Compress files into a zip archive (Android only). - **delFile(filePath)**: Delete a file. - **unzip(filePath, destPath)**: Decompress a file. - **movefile(sourcePath, destPath)**: Move a file. - **copyfile(sourcePath, destPath)**: Copy a file. ``` -------------------------------- ### Control Wi-Fi Switch Source: https://www.touchsprite.com/helpdoc Enables or disables the device's Wi-Fi connection. ```Lua setWifiEnable(enable) ``` -------------------------------- ### Web View UI Functions Source: https://www.touchsprite.com/helpdoc Functions for creating and managing embedded web views within the script UI. Note: iOS 7 system compatibility may be limited. ```Lua webview.new(name) myweb1.show() myweb1.set(key, value) myweb1.close() event.register(eventName, callback) ``` -------------------------------- ### Check Battery Status and Level Source: https://www.touchsprite.com/helpdoc Monitors the device's battery status (e.g., charging, discharging) and current charge level. ```Lua batteryStatus() ``` -------------------------------- ### Coroutine Management Functions Source: https://www.touchsprite.com/helpdoc Functions for creating, managing, and synchronizing coroutines (lightweight threads) within a script. ```Lua thread.create(func) thread.createSubThread(func) thread.stop(threadID) thread.wait(threadID) thread.setTimeout(threadID, timeout) thread.clearTimeout(threadID) thread.waitAllThreadExit() ``` -------------------------------- ### System Control Functions Source: https://www.touchsprite.com/helpdoc Functions to control various system settings and features of the device, including network, Bluetooth, screen, and sound. ```APIDOC ## System Control Functions ### Description Functions to control various system settings and features of the device. ### Functions - **setRotationLockEnable(enable)**: Enable or disable device orientation lock (iOS only). - **setWifiEnable(enable)**: Enable or disable Wi-Fi. - **setBTEnable(enable)**: Enable or disable Bluetooth. - **setAirplaneMode(enable)**: Enable or disable airplane mode. - **getVPNStatus()**: Get the VPN status. - **setVPNEnable(enable)**: Enable or disable VPN (iOS only). - **setCellularDataEnable(enable)**: Enable or disable cellular data (iOS only). - **setAssistiveTouchEnable(enable)**: Enable or disable AssistiveTouch (iOS only). - **setReduceMotionEnable(enable)**: Enable or disable Reduce Motion (iOS only). - **getBacklightLevel()**: Get the screen brightness level. - **setBacklightLevel(level)**: Set the screen brightness level. - **setVolumeLevel(level)**: Set the device volume level. - **vibrator(duration)**: Vibrate the phone for a specified duration. - **playAudio(audioPath)**: Play an audio file. - **stopAudio()**: Stop audio playback (Android only). - **lockDevice()**: Lock the device. - **deviceIsLock()**: Check if the device is locked. - **unlockDevice()**: Unlock the device. - **setAutoLockTime(seconds)**: Set the auto-lock screen time. - **resetIDLETimer()**: Reset the screen lock timer. - **setScreenResolution(width, height)**: Change the screen resolution (iOS only). - **clearKeyChain()**: Clear the keychain (iOS only). - **saveImageToAlbum(imagePath)**: Save an image to the photo album. - **saveVideoToAlbum(videoPath)**: Save a video to the photo album. - **writePasteboard(text)**: Write text to the pasteboard. - **readPasteboard()**: Read text from the pasteboard. - **connectToWifi(ssid, password)**: Connect to a Wi-Fi network. ``` -------------------------------- ### Device Information Functions Source: https://www.touchsprite.com/helpdoc Functions to retrieve various information about the device, such as type, ID, OS version, memory, and network details. ```APIDOC ## Device Information Functions ### Description Functions to retrieve various information about the device. ### Functions - **getDeviceType()**: Get the device type. - **getDeviceID()**: Get the TouchSprite device ID. - **getTSAccountID()**: Get the TouchSprite account ID (Android only). - **getCPUType()**: Get the CPU model (Android only). - **getMemoryInfo()**: Get the device memory information. - **getTSVer()**: Get the engine version number. - **getOSVer()**: Get the system version number. - **getOSType()**: Get the device operating system type. - **getProcess()**: Get the list of device processes. - **getDeviceAlias()**: Get the device alias (Enterprise version only). - **batteryStatus()**: Check battery status and level. - **getDeviceName()**: Get the device name. - **getIMEI()**: Get the device IMEI (Android only). - **getNetworkIP()**: Get the network IP address (Android only). - **getDeviceBrand()**: Get the device brand (Android only). - **getDeviceModel()**: Get the device model (Android only). - **getUUID()**: Get the UUID (Android only). - **getSDCardPath()**: Get the SD card path (Android only). - **getDPI()**: Get the screen DPI and pixel density (Android only). ``` -------------------------------- ### Message Output Functions Source: https://www.touchsprite.com/helpdoc Functions for displaying messages and dialogs to the user. ```APIDOC ## Message Output Functions ### Description Functions for displaying messages and dialogs to the user. ### Functions - **dialog(message)**: Display a message dialog. - **toast(message)**: Display a toast message. - **dialogRet(title, message, buttons)**: Display a dialog with buttons and return the user's choice. - **dialogInput(title, message, defaultValue)**: Display a dialog for user input. - **initLog(logPath)**: Initialize logging. - **wLog(message)**: Write a message to the log. - **closeLog()**: Close the log. - **sysLog(message)**: Write a message to the system log. - **nLog(message)**: Send a message to a remote log. ``` -------------------------------- ### Uninstall Application (Android) Source: https://www.touchsprite.com/helpdoc Uninstalls an application from the device using its package name. This function is only supported on Android devices. ```Lua uninstallApp(packageName) ``` -------------------------------- ### Save Video to Album Source: https://www.touchsprite.com/helpdoc Saves a video file to the device's photo library. ```Lua saveVideoToAlbum(filePath) ``` -------------------------------- ### Script UI Functions Source: https://www.touchsprite.com/helpdoc Functions for creating and managing user interfaces within scripts using JSON definitions. ```APIDOC ## Script UI Functions ### Description Functions for creating and managing user interfaces within scripts using JSON definitions. ### Functions - **showUI(jsonConfig)**: Display a user interface defined by a JSON configuration. ### UI Components - **Label**: Text label. - **RadioGroup**: Group of radio buttons. - **CheckBoxGroup**: Group of checkboxes. - **Edit**: Single-line text input. - **TextArea**: Multi-line text input. - **ComboBox**: Dropdown list. - **Image**: Image display. - **Web**: Embedded web view (not supported on iOS 7). - **Line**: Separator line. - **Switch**: Toggle switch. ### Web UI Functions - **webview.new()**: Create a new webview. - **myweb1.show()**: Display the webview. - **myweb1.set(config)**: Change the appearance of the webview. - **myweb1.close()**: Close the webview. - **event.register(message, handler)**: Send a message and pass parameters. ``` -------------------------------- ### Set Auto-Lock Timer Source: https://www.touchsprite.com/helpdoc Sets the time interval after which the device will automatically lock. ```Lua setAutoLockTime(seconds) ``` -------------------------------- ### Save Image to Album Source: https://www.touchsprite.com/helpdoc Saves an image file to the device's photo album. ```Lua saveImageToAlbum(filePath) ``` -------------------------------- ### Uninstall Application (iOS) Source: https://www.touchsprite.com/helpdoc Uninstalls an application from the device using its bundle identifier. This function is only supported on iOS devices. ```Lua ipaUninstall(bundleID) ``` -------------------------------- ### Control Bluetooth Switch Source: https://www.touchsprite.com/helpdoc Enables or disables the device's Bluetooth connection. ```Lua setBTEnable(enable) ``` -------------------------------- ### Set Device Name (iOS) Source: https://www.touchsprite.com/helpdoc Sets a custom name for the device. This function is only supported on iOS devices. ```Lua setDeviceName(name) ``` -------------------------------- ### Control VPN Connection (iOS) Source: https://www.touchsprite.com/helpdoc Enables or disables the VPN connection on the device. This function is only supported on iOS devices. ```Lua setVPNEnable(enable) ``` -------------------------------- ### Force Restart TouchSprite Service Source: https://www.touchsprite.com/helpdoc A command to forcefully restart the TouchSprite background service. This can resolve issues with unresponsive services. ```Shell 命令: 强制重启触动服务 ``` -------------------------------- ### Double Press Home Button (iOS) Source: https://www.touchsprite.com/helpdoc Simulates a double press of the Home button, typically used for accessing the app switcher. This function is only supported on iOS devices. ```Lua doublePressHomeKey() ``` -------------------------------- ### Switching TouchSprite Input Method (Android) Source: https://www.touchsprite.com/helpdoc Switches the active input method to TouchSprite's custom input method. This is specific to Android devices. ```Lua switchTSInputMethod() ``` -------------------------------- ### External Command Execution Source: https://www.touchsprite.com/helpdoc Functions to execute external commands or system operations. ```APIDOC ## External Command Execution ### Description Functions to execute external commands or system operations. ### Commands - **os.execute(command)**: Execute an operating system command. - **respring()**: Log out and restart the SpringBoard (iOS only). - **poweroff()**: Shut down the device (iOS only). - **reboot()**: Reboot the device. - **clearCache()**: Clear cache (iOS only). ``` -------------------------------- ### Check if Application is in Foreground Source: https://www.touchsprite.com/helpdoc Determines if a specific application is currently the active foreground application on the device. ```Lua isFrontApp(appName) ``` -------------------------------- ### UTF-8 Encoding Functions Source: https://www.touchsprite.com/helpdoc Functions for handling UTF-8 encoded strings, including character conversion, code point retrieval, and length calculation. ```Lua utf8.char(integer, ...) utf8.codes(string) utf8.codepoint(string, i, j) utf8.len(string, i, j) utf8.offset(string, n, i) ``` -------------------------------- ### Check if Device is Locked Source: https://www.touchsprite.com/helpdoc Returns a boolean indicating whether the device screen is currently locked. ```Lua deviceIsLock() ``` -------------------------------- ### Control Reduce Motion Setting (iOS) Source: https://www.touchsprite.com/helpdoc Enables or disables the 'Reduce Motion' accessibility setting. This function is only supported on iOS devices. ```Lua setReduceMotionEnable(enable) ``` -------------------------------- ### Thread (Coroutine) Functions Source: https://www.touchsprite.com/helpdoc Functions for managing and controlling coroutines (threads) within the script. ```APIDOC ## Thread (Coroutine) Functions ### Description Functions for managing and controlling coroutines (threads) within the script. ### Functions - **thread.create(function)**: Create a new coroutine. - **thread.createSubThread(function)**: Create a sub-coroutine. - **thread.stop()**: Stop the coroutine queue. - **thread.wait()**: Block and wait for the current coroutine to complete. - **thread.setTimeout(function, delay)**: Set a timeout for a coroutine. - **thread.clearTimeout(timeoutId)**: Clear a coroutine timeout. - **thread.waitAllThreadExit()**: Block and wait for all coroutines to exit. ``` -------------------------------- ### TouchSprite Specific Functions Source: https://www.touchsprite.com/helpdoc Functions related to TouchSprite's authorization, runtime permissions, and core functionalities. ```APIDOC ## TouchSprite Specific Functions ### Description Functions related to TouchSprite's authorization, runtime permissions, and core functionalities. ### Functions - **deviceIsAuth()**: Check the authorization status of TouchSprite (iOS only). - **getRunningAccess()**: Get the current script's running permissions (Android only). - **userPath()**: Get the client file path. - **whoAmI()**: Detect the type of TouchSprite product. - **showFloatButton(visible)**: Show or hide the floating button. - **[Force Restart TouchSprite Service]**: Command to force restart the TouchSprite service. ``` -------------------------------- ### Unlock Device Source: https://www.touchsprite.com/helpdoc Unlocks the device screen. This may require authentication depending on device settings. ```Lua unlockDevice() ``` -------------------------------- ### Clean Application Data (Android) Source: https://www.touchsprite.com/helpdoc Clears the data associated with a specific application. This function is only supported on Android devices. ```Lua cleanApp(packageName) ``` -------------------------------- ### Script Control Functions Source: https://www.touchsprite.com/helpdoc Functions for controlling the execution of the script itself. ```APIDOC ## Script Control Functions ### Description Functions for controlling the execution of the script itself. ### Functions - **lua_exit()**: Exit the current script. - **lua_restart()**: Reload the current script. - **luaExitIfCall()**: Pause script execution if a call is received. - **checkScriptAuth()**: Check script type and authorization. ``` -------------------------------- ### Control AssistiveTouch Switch (iOS) Source: https://www.touchsprite.com/helpdoc Enables or disables the AssistiveTouch feature (the small on-screen button). This function is only supported on iOS devices. ```Lua setAssistiveTouchEnable(enable) ``` -------------------------------- ### Lock Device Source: https://www.touchsprite.com/helpdoc Immediately locks the device screen, requiring a passcode or biometric authentication to unlock. ```Lua lockDevice() ``` -------------------------------- ### Check TouchSprite Authorization Status (iOS) Source: https://www.touchsprite.com/helpdoc Checks if the TouchSprite application is authorized to run on the device. This function is only supported on iOS devices. ```Lua deviceIsAuth() ``` -------------------------------- ### Show/Hide Floating Button Source: https://www.touchsprite.com/helpdoc Controls the visibility of the floating button, which can be used for script interaction or control. ```Lua showFloatButton(visible) ``` -------------------------------- ### Close All Background Applications (Android) Source: https://www.touchsprite.com/helpdoc Closes all applications running in the background. This function is only supported on Android devices. ```Lua closeAllApp() ``` -------------------------------- ### Control Airplane Mode Switch Source: https://www.touchsprite.com/helpdoc Enables or disables the device's airplane mode. ```Lua setAirplaneMode(enable) ``` -------------------------------- ### Network Time Function Source: https://www.touchsprite.com/helpdoc Function to retrieve the current network time. ```APIDOC ## Network Time Function ### Description Function to retrieve the current network time. ### Function - **getNetTime()**: Get the current network time. ``` -------------------------------- ### Contact Management Functions Source: https://www.touchsprite.com/helpdoc Functions for managing contacts in the device's address book. ```APIDOC ## Contact Management Functions ### Description Functions for managing contacts in the device's address book. ### Functions - **addContactToAB(contactInfo)**: Add a contact to the address book. - **removeAllContactsFromAB()**: Clear all contacts from the address book. ``` -------------------------------- ### Set Screen Rotation Lock (iOS) Source: https://www.touchsprite.com/helpdoc Enables or disables the screen rotation lock on the device. This function is only supported on iOS devices. ```Lua setRotationLockEnable(enable) ``` -------------------------------- ### Stop Audio Playback (Android) Source: https://www.touchsprite.com/helpdoc Stops any currently playing audio. This function is only supported on Android devices. ```Lua stopAudio() ``` -------------------------------- ### Control Cellular Data Switch (iOS) Source: https://www.touchsprite.com/helpdoc Enables or disables the cellular data connection on the device. This function is only supported on iOS devices. ```Lua setCellularDataEnable(enable) ``` -------------------------------- ### Modify Screen Resolution (iOS) Source: https://www.touchsprite.com/helpdoc Changes the screen resolution of the device. This function is only supported on iOS devices. ```Lua setScreenResolution(width, height) ``` -------------------------------- ### Vibrate Device Source: https://www.touchsprite.com/helpdoc Causes the device to vibrate for a specified duration. ```Lua vibrator(duration) ``` -------------------------------- ### OCR and Text Recognition Functions Source: https://www.touchsprite.com/helpdoc Functions for performing Optical Character Recognition (OCR) and text recognition. ```APIDOC ## OCR and Text Recognition Functions ### Description Functions for performing Optical Character Recognition (OCR) and text recognition. ### Functions - **ocrText(region)**: Perform local OCR on a specified region. - **addTSOcrDict(dictPath)**: Add a dictionary for TouchSprite OCR. - **addTSOcrDictEx(dictPath, index)**: Add an extended dictionary for TouchSprite OCR. - **tsOcrText(region)**: Recognize text using TouchSprite OCR. - **tsFindText(region, text)**: Find text using TouchSprite OCR. - **addDmOcrDict(dictPath)**: Add a dictionary for Damaged Code OCR. - **dmOcrText(region)**: Recognize text using Damaged Code OCR. - **dmFindText(region, text)**: Find text using Damaged Code OCR. ``` -------------------------------- ### OCR Text Recognition Source: https://www.touchsprite.com/helpdoc Performs Optical Character Recognition (OCR) on an image to extract text. Supports local and dictionary-based methods. ```Lua ocrText(imagePath) addTSOcrDict(dictPath) addTSOcrDictEx(dictPath) tsOcrText(imagePath, dictPath) tsFindText(imagePath, dictPath) addDmOcrDict(dictPath) dmOcrText(imagePath, dictPath) dmFindText(imagePath, dictPath) ``` -------------------------------- ### Reset Auto-Lock Timer Source: https://www.touchsprite.com/helpdoc Resets the device's idle timer, preventing it from automatically locking until the next inactivity period. ```Lua resetIDLETimer() ``` -------------------------------- ### Clear Keychain Data (iOS) Source: https://www.touchsprite.com/helpdoc Removes all data stored in the device's keychain. This function is only supported on iOS devices. ```Lua clearKeyChain() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.