Proxy Events
Overview
- All proxy event module functions require PC activation; no root needed
- The proxy event module uses the
agentEventprefix, e.g.agentEvent.clickPoint() - Functions listed here are specific to proxy mode; use global functions for other calls
Settings
setAgentCallParam Set Proxy Global Communication Timeout
- Set proxy mode parameters
- Requires EC 7.0.0+
- @param data Parameter map
- Example:
{"remoteCallTimeout":10000} - remoteCallTimeout: Remote call timeout in milliseconds; default 10 seconds
- @return
{bool}true on success, false on failure
function main() { var result = agentEvent.setAgentCallParam({"remoteCallTimeout": 10000}); if (result) { toast("yes"); } else { toast("no"); }}
main();Input
setCurrentIme Set Current Input Method
- Set the current IME for text input
- @return
{boolean}
function main() { var result = agentEvent.setCurrentIme(); if (result) { toast("yes"); } else { toast("no"); }}
main();restoreIme Restore Previous Input Method
- Restore the previous IME
- @return
{boolean}
function main() { var result = agentEvent.restoreIme(); if (result) { toast("yes"); } else { toast("no"); }}
main();Screenshot
fastScreenshot Fast Full-Screen Screenshot
- Capture a fast full-screen screenshot
- @param filename File path
- @return string Path to the screenshot
function main() { var result = agentEvent.fastScreenshot("/sdcard/a.jpg"); toast("result:" + result);}
main();Gestures and Input Events
inputEvent Execute Input Event
- Execute an input event
- @param action Action; see MotionEvent.ACTION_*
- @param x X coordinate
- @param y Y coordinate
- @param metaState Modifier keys such as shift, alt, ctrl; 0 or 1
- @return boolean true on success, false on failure
function main() { var result = agentEvent.inputEvent(1, 10, 10, 0); if (result) { toast("success"); } else { toast("failed"); }}
main();touchDown Touch Down
- Execute touch-down input event
- @param x X coordinate
- @param y Y coordinate
- @return boolean true on success, false on failure
function main() { // Must be used together; alone it has no effect // Touch down agentEvent.touchDown(100, 100) sleep(50) // Move agentEvent.touchMove(100, 150) sleep(50) // Move agentEvent.touchMove(100, 200) sleep(50) // Touch up agentEvent.touchUp(100, 200) sleep(200)}
main();touchMove Touch Move
- Execute touch-move input event
- @param x X coordinate
- @param y Y coordinate
- @return boolean true on success, false on failure
function main() { // Must be used together; alone it has no effect // Touch down agentEvent.touchDown(100, 100) sleep(50) // Move agentEvent.touchMove(100, 150) sleep(50) // Move agentEvent.touchMove(100, 200) sleep(50) // Touch up agentEvent.touchUp(100, 200) sleep(200)}
main();touchUp Touch Up
- Execute touch-up input event
- @param x X coordinate
- @param y Y coordinate
- @return boolean true on success, false on failure
function main() { // Must be used together; alone it has no effect // Touch down agentEvent.touchDown(100, 100) sleep(50) // Move agentEvent.touchMove(100, 150) sleep(50) // Move agentEvent.touchMove(100, 200) sleep(50) // Touch up agentEvent.touchUp(100, 200) sleep(200)}
main();pressKey Simulate Key Press
- Simulate a key press, e.g. home, back
- @param key Values: home, back, left, right, up, down, center, menu, search, enter, delete (or del), recent (recent apps), volume_up, volume_down, volume_mute, camera, power
- @return boolean true on success, false on failure
function main() { var result = agentEvent.pressKey("home"); if (result) { toast("success"); } else { toast("failed"); }}
main();pressKeyCode Simulate Keyboard Input
- Simulate keyboard input
- @param keyCode Key code; see KeyEvent.KEYCODE_*
- @return boolean true on success, false on failure
function main() { var result = agentEvent.pressKeyCode(65); if (result) { toast("success"); } else { toast("failed"); }}
main();pressKeyCodeWithMetaState Simulate Keyboard Input with Meta State
- Simulate keyboard input with modifier keys
- @param keyCode Key code; see KeyEvent.KEYCODE_*
- @param metaState Modifier keys such as shift, alt, ctrl; 0 or 1
- @return boolean true on success, false on failure
function main() { var result = agentEvent.pressKeyCodeWithMetaState(65, 1); if (result) { toast("success"); } else { toast("failed"); }}
main();System Keys
menu Open Menu
- Open the menu
- @return
{null|boolean}
function main() { var result = agentEvent.menu(); if (result) { toast("success"); } else { toast("failed"); }}
main();enter Enter Key
- Enter key
- @return
{null|boolean}
function main() { var result = agentEvent.enter(); if (result) { toast("success"); } else { toast("failed"); }}
main();delete Delete Key
- Delete key
- @return
{null|boolean}
function main() { var result = agentEvent.delete(); if (result) { toast("success"); } else { toast("failed"); }}
main();search Search
- Search key
- @return
{null|boolean}
function main() { var result = agentEvent.search(); if (result) { toast("success"); } else { toast("failed"); }}
main();Screen Control
closeScreen Turn Screen Off
- Turn off the screen (display off but automation still works; unlike sleepScreen)
- @return boolean true on success, false on failure
function main() { // If this function does not work, download another plugin from the forum // https://bbs.ieasyclick.com/thread-617-1-1.html var x = agentEvent.closeScreen();}
main();lightScreen Turn Screen On
- Turn on the screen (opposite of closeScreen)
- @return boolean true on success, false on failure
function main() { var x = agentEvent.lightScreen(); // If this function has no effect, force wake the screen with: // agentEvent.execShellCommandEx("input keyevent 26 && input keyevent 82 && input keyevent 82")}
main();