ScreenCapture

Control screen capture

Overview

    // You can use stop() to handle orientation change
    if (Env.deviceX() < Env.deviceY()) {
        //device switch to portrai mode
        ScreenCapture.stop() //stop screen capture
        //Switch the macro orientation
        var temp = Env.macroX()
        Env.setMacroX(Env.macroY())
        Env.setMacroY(temp)
    }

    var region = Region.deviceReg().middle()
    var match = region.find("image") //This call will start screen capture in portrait

    // You can use it to reduce power consumption when you know you're gonna wait for long
    ScreenCapture.stop()
    wait(30000)

    // isRunning() check if Screen Capture object is still alive. This does not tell if it's actually capturing though. 
    // The device could turn off screen capture at any moment and it could still return true. Not that useful but i put it as a way to debug if the stop() command work correctly

Static Methods
stop
static bool stop()

Stop screen capture. The next call require screen capture will auto restart it

Return
bool true if success, fail otherwise
isRunning
static bool isRunning()

Check if Screen Capture is running. This does not mean it's still capturing, the device could turn it off at any time

Return
bool true if running, false otherwise

© 2024 - Macrorify by KoK-CODE