Function reference
All 87 functions you can call in an AppsMobs script, by category, with signature and an example.
Last reviewed 2 November 2026
You will be able to find the function you need and write it correctly. ⏱ 2 minutes to look something up; the rest is for reference.
Before you start
- You know how to create and run a script: Your first script in 10 minutes.
- You know the rules of an AppsMobs Python script: Writing a Python script.
87 functions in 9 categories. For each: the signature, what it does, an example to copy.
How to read this page
- No
import, no phone to pass. The functions are already there and act on the device chosen in Run on. Writetap(540, 1200), nevertap(client, 540, 1200). - Signatures are the editor's. A parameter with
=is optional:conf=0.8means "0.8 if you say nothing". - Coordinates are those of the device image shown in AppsMobs:
(0, 0)is top left,ygrows downward. - Same vocabulary everywhere:
conf(confidence from 0 to 1),region(area(x, y, width, height)),timeout(seconds),offset((dx, dy)shift of the tap). timeout:0= a single try, a number = wait up to that delay,None= wait forever (choose it on purpose). Nothing waits forever by default.- The Function reference panel of the editor (More actions menu, Tools group) shows the same entries.
I want to… → I use…
| I want to… | I use… |
|---|---|
| Tap a point on the screen | tap(540, 1200) |
| Scroll a list | swipe_up() or swipe_down() |
| Tap a button I have a screenshot of | tap_image("button.png") |
| Wait for an image to appear | wait_image("home.png", timeout=20) |
| Know whether an image is on screen | image_visible("popup.png") |
| Tap a button by its text | tap_text("Settings") |
| Wait for a text to show up | wait_text("Welcome", timeout=20) |
| Type text in a field | type_text("hello") |
| Go back or go home | press_back(), press_home() |
| Launch an app | open_app("com.android.chrome") |
| Close or restart an app | close_app("com.android.chrome"), restart_app("com.android.chrome") |
| Pause | wait(2) or random_wait(1, 3) |
| Write a message in the output | log("step 1 done") |
| Ask a question while running | name = input("Your nickname?") |
| Stop the script cleanly | finish() |
Gestures (13)
Tap, swipe, pinch. Gestures are computed from the real screen size. touch_down and touch_up need scrcpy.
tap(x, y) : Tap. Tap the screen at (x, y). Coordinates are those of the device image shown in AppsMobs.
tap(540, 1200)
double_tap(x, y) : Double tap. Two quick taps at the same point.
double_tap(540, 1200)
long_press(x, y, duration_ms=1000) : Long press. Keep the finger down for duration_ms milliseconds.
long_press(540, 1200, duration_ms=1500)
swipe(x1, y1, x2, y2, duration_ms=500) : Swipe. Slide the finger from one point to another, like a human (it slows down at the end).
swipe(540, 1600, 540, 600)
swipe_up(distance=None, duration_ms=500) : Swipe up. The finger moves up: the page scrolls down. distance in pixels (40% of the screen by default).
swipe_up()
swipe_down(distance=None, duration_ms=500) : Swipe down. The finger moves down: the page scrolls back up.
swipe_down()
swipe_left(distance=None, duration_ms=500) : Swipe left. The finger moves left (next page of a carousel).
swipe_left()
swipe_right(distance=None, duration_ms=500) : Swipe right. The finger moves right (previous page).
swipe_right()
drag(x1, y1, x2, y2, duration_ms=1000) : Drag. Long press the first point then slide to the second: move an icon or an item.
drag(200, 800, 800, 800)
pinch_in(x=None, y=None) : Pinch in (zoom out). Bring two fingers together towards the point (screen centre by default). Real two-finger gesture with scrcpy, approximated without.
pinch_in()
pinch_out(x=None, y=None) : Pinch out (zoom in). Spread two fingers from the point.
pinch_out()
touch_down(x, y) : Finger down. Put the finger down without lifting it (with touch_up for a custom gesture). Requires scrcpy.
touch_down(540, 1200)
touch_up(x, y) : Finger up. Lift the finger put down by touch_down.
touch_up(540, 1200)
Images on screen (12)
Look for an image (a .png) on the screen. The file is searched in the script's folder, then in Scripts\img. Shared parameters: conf (0 to 1), region, timeout, offset.
find_image(img, conf=0.8, region=None, timeout=0) : Find an image. Position (x, y) of the image centre on screen, or None. timeout: seconds to wait (0 = one try).
pos = find_image("bouton.png")
if pos:
tap(*pos)
image_visible(img, conf=0.8, region=None) : Image visible?. True if the image is on screen right now, False otherwise.
if image_visible("popup.png"):
press_back()
wait_image(img, conf=0.8, region=None, timeout=30) : Wait for an image. Wait until the image appears. Returns (x, y), or None after timeout seconds: the script goes on.
if wait_image("accueil.png", timeout=20):
log("chargé")
find_image_positions(img, conf=0.8, region=None) : All positions. List of every position (x, y) where the image appears, top to bottom.
for x, y in find_image_positions("piece.png"):
tap(x, y)
first_image(imgs, conf=0.8, region=None, timeout=30) : First image of a list. Wait until one of the images appears. Returns (image, x, y), or None after timeout.
res = first_image(["gagne.png", "perdu.png"])
if res:
nom, x, y = res
tap_image(img, conf=0.8, region=None, timeout=30, offset=(0, 0)) : Tap an image. Wait for the image (30 s by default) then tap it. offset=(dx, dy) shifts the tap. Returns True if tapped.
tap_image("jouer.png")
double_tap_image(img, conf=0.8, region=None, timeout=30, offset=(0, 0)) : Double tap an image. Wait for the image then tap it twice.
double_tap_image("photo.png")
long_press_image(img, duration_ms=1000, conf=0.8, region=None, timeout=30) : Long press an image. Wait for the image then keep the finger on it.
long_press_image("icone.png", duration_ms=1500)
tap_first_image(imgs, conf=0.8, region=None, timeout=30, offset=(0, 0)) : Tap the first image found. Tap the first image of the list that appears. Returns its name, or None.
choix = tap_first_image(["ok.png", "fermer.png"])
tap_all_images(img, conf=0.8, region=None) : Tap every occurrence. Tap every place where the image appears. Returns how many taps.
n = tap_all_images("coeur.png")
scroll_to_image(img, direction='down', max_swipes=20, conf=0.8, region=None) : Scroll to an image. Scroll the page (direction "down" or "up") until the image is visible. Returns (x, y) or None.
pos = scroll_to_image("article.png")
tap_until_image(positions, img, max_taps=10, conf=0.8, region=None) : Tap until an image shows. Tap the positions in turn until the image appears. Returns True if it appeared.
tap_until_image([(540, 1800)], "suite.png")
Text on screen (5)
Read text from the Android interface, without images. It works for text the app exposes; text drawn inside an image cannot be read this way.
tap_text(text, exact=True, timeout=0) : Tap a text. Tap the element showing this text (read from the Android interface, no image). exact=False: contains the text.
tap_text("Paramètres")
text_visible(text, exact=True) : Text visible?. True if an element shows this text right now.
if text_visible("Connexion"):
log("écran de connexion")
wait_text(text, exact=True, timeout=30) : Wait for a text. Wait until an element shows this text. Returns (x, y), or None after timeout.
wait_text("Bienvenue", timeout=20)
read_text_at(x, y) : Read text at a point. Text of the element under (x, y), or None.
prix = read_text_at(540, 900)
read_text_by_id(resource_id) : Read an element's text. Text of the element with the given Android id, or None.
titre = read_text_by_id("com.app:id/titre")
Input & keys (11)
Text input, clipboard and system keys. Test accents and special characters first: typing in the Control screen does not accept them.
type_text(text) : Type text. Type text into the focused field.
type_text("bonjour")
clear_text() : Clear the field. Clear the focused field.
clear_text()
select_all() : Select all. Select all the text of the focused field.
select_all()
copy() : Copy. Copy the selection.
copy()
paste() : Paste. Paste into the focused field.
paste()
set_clipboard(text) : Set clipboard. Put text into the device clipboard.
set_clipboard("code promo")
get_clipboard() : Get clipboard. Clipboard text, or None.
texte = get_clipboard()
press_back(times=1) : Back key. Press Back (times times).
press_back()
press_home() : Home key. Go to the home screen.
press_home()
press_enter() : Enter key. Submit the focused field.
press_enter()
recent_apps() : Recent apps. Open the recent apps list.
recent_apps()
Screen (7)
Size, pixel colour, screenshot, scrolling.
screen_size() : Screen size. (width, height), in tap() coordinates.
w, h = screen_size()
pixel_color(x, y) : Pixel colour. Colour (blue, green, red) of the pixel, or None.
b, g, r = pixel_color(10, 10)
pixel_is(x, y, color, tolerance=10) : Pixel has this colour?. True if the pixel has the colour (blue, green, red), within tolerance.
if pixel_is(100, 200, (0, 0, 255)):
log("rouge")
screenshot(filename='screenshot.png') : Screenshot. Save a capture. Returns the file path.
screenshot("capture.png")
"capture.png", "captures/screen.png") saves the image in your script's folder. Up to and including version 1.2.6, the image went to an internal app folder: on those versions, write the full path, for example screenshot(f"{SCRIPT_DIR}/capture.png").scroll_to_top(max_swipes=3) : Scroll to top. Scroll to the top of the page.
scroll_to_top()
scroll_to_bottom(max_swipes=3) : Scroll to bottom. Scroll to the bottom of the page.
scroll_to_bottom()
pull_to_refresh() : Pull to refresh. Pull the top of the page down to refresh it.
pull_to_refresh()
Apps (8)
Launch, stop, install apps. An app's package name (com.android.chrome) comes from installed_apps().
open_app(package, activity=None) : Open an app. Launch an app by its package name (see installed_apps()).
open_app("com.android.chrome")
close_app(package=None) : Close an app. Stop an app (without package: the one in the foreground).
close_app("com.android.chrome")
restart_app(package) : Restart an app. Stop then launch an app again.
restart_app("com.android.chrome")
clear_app_data(package) : Clear an app's data. Erases ALL the app's data (login, settings), like a reinstall.
clear_app_data("com.exemple.jeu")
install_app(apk) : Install an app. Install an .apk file from the PC.
install_app("C:/apk/app.apk")
uninstall_app(package) : Uninstall an app. Uninstall an app.
uninstall_app("com.exemple.app")
installed_apps(system_apps=False) : Installed apps. List of installed packages (system_apps=True: system apps included).
for p in installed_apps():
log(p)
app_info(package) : App info. Open the app's info page in the settings.
app_info("com.android.chrome")
Device & system (15)
Wake, reboot, network, volume, notifications. Rebooting the device also stops its scripts.
wake_screen() : Wake the screen. Turn the screen on.
wake_screen()
reboot() : Reboot. Reboot the device.
reboot()
device_info() : Device info. Model, Android version, serial (dictionary).
info = device_info()
log(info["model"])
adb(command) : adb command. Run an adb shell command and return its output.
modele = adb("getprop ro.product.model")
set_wifi(on=True) : Wi-Fi. Turn Wi-Fi on (True) or off (False).
set_wifi(False)
set_mobile_data(on=True) : Mobile data. Turn mobile data on or off.
set_mobile_data(True)
set_airplane_mode(on=True) : Airplane mode. Turn airplane mode on or off.
set_airplane_mode(True)
rotate(orientation='landscape') : Rotate. Set the orientation: "portrait" or "landscape".
rotate("landscape")
volume_up() : Volume up. Turn the volume up.
volume_up()
volume_down() : Volume down. Turn the volume down.
volume_down()
mute() : Mute. Mute or unmute.
mute()
open_notifications() : Open notifications. Open the notification shade.
open_notifications()
close_notifications() : Close notifications. Close the notification shade.
close_notifications()
open_settings(category=None) : Open settings. Open Android settings, or a category ("wifi", "bluetooth", "display"…).
open_settings("wifi")
vibrate(duration_ms=1000) : Vibrate. Vibrate for duration_ms milliseconds.
vibrate(500)
Phone (10)
SMS, calls, contacts, alarms and timers. These functions really act on the phone: try them on a test device first.
send_sms(number, message) : Send an SMS. Send an SMS.
send_sms("+33600000000", "Bonjour")
read_sms(limit=10) : Read SMS. Latest received SMS.
for sms in read_sms(5):
log(sms)
call(number) : Call. Call a number.
call("+33600000000")
answer_call() : Answer. Answer the incoming call.
answer_call()
hang_up() : Hang up. End the call.
hang_up()
contacts(limit=50) : Contacts. List of contacts.
for c in contacts():
log(c)
set_alarm(hour, minute, label='Alarme') : Set an alarm. Create an alarm.
set_alarm(7, 30, "Réveil")
cancel_alarm(hour=None, minute=None) : Cancel an alarm. Delete an alarm (no time: all of them).
cancel_alarm(7, 30)
alarms() : Alarms. List of alarms.
log(alarms())
set_timer(hours=0, minutes=0, seconds=0) : Timer. Start a timer.
set_timer(minutes=5)
Time & flow (6)
Pauses, repetitions, output and ending the script. log, input and finish are provided by the script launcher.
wait(seconds) : Wait. Wait in SECONDS (0.5 = half a second). The Playground Pause button is honoured.
wait(2)
random_wait(min_s=0.35, max_s=0.8) : Random wait. Wait a random time between min_s and max_s seconds: a less regular pace.
random_wait(1, 3)
repeat(action, times, *args) : Repeat. Call a function several times with the same arguments. Returns the list of results.
repeat(tap, 5, 540, 1200)
log(message, level='INFO') : Write to the output. Show a timestamped message in the Output panel.
log("étape 1 terminée")
input(question='') : Ask for a value. Ask a question in the Playground console and wait for the answer.
nom = input("Ton pseudo ?")
finish() : Finish the script. Stop the script cleanly.
finish()
Not working?
NameError: name '...' is not defined: the function does not exist under that name. Compare with the list above (names are English:tap, notclick).image introuvable : button.png (cherchée dans le dossier du script et dans Scripts/img)(this message is in French even in the English app): the.pngfile is not in the right place. See Writing a Python script.- Nothing happens when you tap: check the coordinates with Device screenshot; they are those of the device image.
- The image-AI functions (
smart_*, YOLO) are not listed here: they are being reworked, do not use them yet.
What next
- Writing a Python script: the rules and good habits.
- Write scripts with Claude or Grok: ask it to write the script with these functions.
- Build without code: the block editor