User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


Shows how to use the SimulateTouch method

Code from the DroidScript-Beta forum posted by Dave Smart.

Here is an example which automatically keeps pressing a button forever (Note you can simulate “Up”, “Down” and “Move” events)

//Called when application is started.
function OnStart()
	//Create a layout with objects vertically centered.
	lay = app.CreateLayout( "linear", "VCenter,FillXY" );	
	//Create image 1/5 of screen width and correct aspect ratio.
	img = app.CreateImage( "/Sys/Img/Hello.png", 0.2, -1 );
	lay.AddChild( img );
	//Create a button 1/3 of screen width and 1/10 screen height.
	btn = app.CreateButton( "Press Me", 0.3, 0.1 );
	btn.SetMargins( 0, 0.05, 0, 0 );
	lay.AddChild( btn );
	//Set function to call when button pressed.
	btn.SetOnTouch( btn_OnTouch );
	//Add layout to app.	
	app.AddLayout( lay );
//Called when user touches our button.
function btn_OnTouch()
    app.Vibrate( "0,100,30,100,50,300" );
    setTimeout( SimTouch, 1000 );
function SimTouch()
    app.SimulateTouch( btn );
    app.SimulateTouch( btn, 0.5, 0.5, "Down" );
    app.Wait( 0.1 );
    app.SimulateTouch( btn,  0.5,  0.5, "Up" );
sample_code/simulate_touch.txt · Last modified: 2014/12/22 00:06 (external edit)