MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / MyAction

Class MyAction

test/python/binding_test.py:199–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199class MyAction(CustomAction):
200 def run(
201 self,
202 context: Context,
203 argv: CustomAction.RunArg,
204 ) -> CustomAction.RunResult:
205 print(f"on MyAction.run, context: {context}, box: {argv.box}")
206 controller = context.tasker.controller
207 new_image = controller.post_screencap().wait().get()
208 print(f" new_image: {new_image.shape}")
209 controller.post_click(191, 98).wait()
210 controller.post_swipe(100, 200, 300, 400, 100).wait()
211 controller.post_input_text("Hello World!").wait()
212 controller.post_click_key(32).wait()
213 controller.post_touch_down(1, 100, 100, 0).wait()
214 controller.post_touch_move(1, 200, 200, 0).wait()
215 controller.post_touch_up(1).wait()
216 controller.post_key_down(65).wait()
217 controller.post_key_up(65).wait()
218 controller.post_start_app("aaa")
219 controller.post_stop_app("bbb")
220 controller.post_inactive().wait()
221
222 cached_image = controller.cached_image
223 connected = controller.connected
224 uuid = controller.uuid
225 resolution = controller.resolution
226 info = controller.info
227 print(
228 f" connected: {connected}, uuid: {uuid}, resolution: {resolution}, info type: {info.get('type')}"
229 )
230
231 global runned
232 runned = True
233
234 return CustomAction.RunResult(success=True)
235
236
237# ============================================================================

Callers 1

test_resource_apiFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_resource_apiFunction · 0.56