Document

1. General
2. Usage
3. Script

1. General

AutoTouch is used to record and play back your operations in your mobile device.More often it's used to run the lua script written beforehand to implement more powerful features.You may use it to play games automatically to gain more score and coins, even use it to simulate human operations to test your program with nobody.You have to jailbreak the device before installing AutoTouch.Jailbreak is easy and you can search from the internet.

Now AutoTouch have had the ability to record and play back most of the actions such as touches, home button click, volume button click, ringer switch, lock button click at home screen and any other apps with accurate and smooth experience.It also provides the functions for screenshot,screenshot for region,get color of specified point, find point fit specified color and many others.With these you can already control your device freely and skillfully.


2. Usage

2.1. How to install?

  1. Make sure you've added the BigBoss source to the Cydia;
  2. Search and install "AutoTouch" from Cydia;
  3. It will install the dependent app "Activator" automatically, which is used for control management. Do not remove "Activator" or it will remove "AutoTouch" together.

2.2. How to record your operations?

  1. At any view you want to record start, hold on the volume down button(or other action you've set to control it with Activator) until there pops up the control panel which contains a record button and a script list;
  2. Click on the "Record" button, it will start recording immediately with a shot vibrating;
  3. Then do your touch or other operations;
  4. When you want to finish recording, hold on the volume down button(or other action said before) until there pops up an alert noticing it's stopped;
  5. Then you can call out the control panel again by holding on the volume down button to play the script recorded just now, or go ahead to the app to manage it.It uses the create time as the script's filename at default, you can rename it to a more human friendly one.

2.3. How to play the scripts?

  1. At the view where the script will play start, hold on the volume down button(or other action said before) to call out the control panel;
  2. Click on the script that you want to play;
  3. Generally(unless you've set it to play directly in the playing settings of AutoTouch app) there will pop up a view asking for the settings of repeat times, interval(seconds) and speed.If you set the time to 0, it will loop infinitely;
  4. After that, you click on the "Play Now" button, it will start playing immediately with a shot vibrating, and stop with an alert(can be turn off in the settings) when the playing is finished, or you can hold on the volume down button(or other action said before) to interrupt the playing;
  5. If you click on the "Play Later" button, it will enter the "Ready to Play" mode in which you can repeatedly start or interrupt playing by clicking(not holding, can't be changed in Activator) on the volume down button without any interruptive popup asking.Hold on the volume down button(or other action said before) again, it will quit the "Ready to Play" mode;
  6. You can set the playing settings for the scripts in the "Playing Settings" view in AutoTouch app, with witch you can make it play directly with the default settings.

2.4. How to write a script?

  1. Click the "Action" button at middle of the toolbar, then choose "New File";
  2. Write in the edit view to make your script;
  3. Then click the "Save" button to save it.

2.5. How to encrypt a script?

  1. Click on the script in AutoTouch, select the "Encrypt" option;
  2. Input the password, if you don't want a password just leave it blank.
  3. Confirm to encrypt it, then it will generate a file with the same name but .lua.e suffix.
  4. You can play the encrypted scripts just as playing .lua scripts, if it ask for password just input it.

2.6. How to upload the scripts from computer?

  1. Click the "Action" button at middle of the toolbar, choose the "Upload" button to open the upload view;
  2. Open the url provided in the upload view with the web browser from you computer;
  3. Then you can upload and manage your scripts and other files from the browser.

2.7. How to buy a license?

  1. Click on the "License" in the "Settings" view to open the license infomation view;
  2. It will validate you license when open the license infomation view;
  3. If you are not validated, you will find the "Pay with Paypal" button, just click on it;
  4. Then you will switch to the Safari browser window, finish the payment on Paypal official payment site, it is safe;
  5. When payment is finished, switch to the "Settings" view of AutoTouch, click on the "License", it will validate the license if you have connection to the internet;
  6. When the license is validated, you will have all the features of the app.

2.8. How to download and buy script from the store?

  1. You can download any script from the store directly;
  2. Some of the scripts may be encrypted, some may need password to decrypt to run, if need password, you should connect with the author to buy the password;
  3. Downloaded scripts are in the script list, use them as others.

2.9. How to release your script in the store?

  1. You can release your scripts in the store to share or sell to others;
  2. If you just want to share the scripts, you may upload the .lua files directly, if you don't want others know how you implement it, just encrypt them;
  3. If you want to sell your scripts, you should encrypt them and make sure you've set the passwords so that when someone need them could buy from you.

3. Script

3.1. Basic

You can learn lua from Lua Official Reference Manual to know how to use it.


3.2. Extended functions

The extended functions are provided by AutoTouch to give some powerful features on mobile device, with which you can simulate touch operations,find color or image from the screen, etc.


3.2.1. touchDown(id, x, y)

touch on the point(x, y) and set the event id.

touchDown(0, 100, 200); -- touch down at point(100, 200).

3.2.2. touchMove(id, x, y)

touch move to the point(x, y).

touchDown(0, 100, 200); -- touch down at point(100, 200).
touchMove(0, 200, 200); -- touch move to point(200, 200).

3.2.3. touchUp(id, x, y)

touch up from the point(x, y).

touchDown(0, 100, 200); -- touch down at point(100, 200).
touchMove(0, 200, 200); -- touch move to point(200, 200).
touchUp(0, 200, 200); -- touch up from point(200, 200).

3.2.4. tap(x, y)

tap at the point(x, y).

tap(100, 200); -- tap at point(100, 200).

3.2.5. homeButtonDown()

Simulate a home button down event.

homeButtonDown();
-- Simulate a home button down event.

3.2.6. homeButtonUp()

Simulate a home button up event.

homeButtonUp();
-- Simulate a home button up event.

3.2.7. rootDir()

Get the root path of the dir you place the scripts in.

local dirPath = rootDir();
-- dirPath = "/var/mobile/Library/AutoTouch/Scripts/"

3.2.8. usleep(microseconds)

Sleep the process for microseconds.

usleep(1000000);
-- Sleep one second

3.2.9. log(logContent)

Take log of the string type log content.See log in the log view

log("play here...");

3.2.10. alert(message)

Open an alert view to show the message.

alert("Hello world!");

3.2.11. vibrate()

Take a vibration.

vibrate();
-- Take a vibration for a time.

3.2.12. screenshot(filePath)

Take a screenshot and save it to the specified file path.

screenshot("/var/screenshot1.png");
-- Take a screenshot and save it to the specified path.

3.2.13. screenshotRegion(filePath, x, y, width, height)

Take a screenshot and save it to the specified file path.

screenshotRegion("/var/screenshot2.png", 0, 0, 100, 100);
-- Take a screenshot of the region(0, 0, 100, 100)
-- and save it to the specified path.

3.2.14. getScreenResolution()

Get the resolution of your device screen.

local w, h = getScreenResolution();
-- width is 1136, height is 640 for iPhone 5

3.2.15. getScreenSize()

Get the size of your device screen in iOS coordinate system.

local width, height = getScreenSize();
-- width is 320, height is 568 for iPhone 5

3.2.16. getColor(x, y)

Get the RGB color value of the specified point on the screen.

local rgb = getColor(100, 200);
alert("rgb:" .. rgb);
-- rgb:16777215

3.2.17. findColor(rgb, count)

Find all the points fit the specified color on the screen, and return the coordinates of the points as table. Attention: you should use it as find(0x0000ff, 5), but not find(rgb=0x0000ff, count=5), that's different with the findImage function, because the argument of findImage is a table.

local result = findColor(0x0000ff, 2);
for i, v in pairs(result) do
    log("x:" .. v[1] .. "y:" .. v[2]);
end

3.2.18. findColorTap(rgb, count)

This function is almost the same as the findColor(rgb, cout), the difference is findColorTap finds the coordinates then taps them orderly with 0.016 second interval, and it doesn't return anything.

findColorTap(0x0000ff, 2); -- find the first two coordinates which's' color is 0x0000ff, then tap them.

3.2.19. findImage {imagePath, count, fuzzy, ignoreColors}

Find the regions similar to the specified image on the screen, return the top-left coordinates of the regions as table.

-- example 1:
local result = findImage {imagePath="/var/spirit.png", count=5};
for i, v in pairs(result) do
    log("x:" .. v[1] .. "y:" .. v[2]);
end
 
-- example 2:
local result = findImage {imagePath="/var/spirit.png", fuzzy=0.6};
for i, v in pairs(result) do
    log("x:" .. v[1] .. "y:" .. v[2]);
end
        
-- example 3:
local result = findImage {imagePath="/var/spirit.png", ignoreColors={0xffffff, 0x2b2b2b}};
for i, v in pairs(result) do
    log("x:" .. v[1] .. "y:" .. v[2]);
end
          
-- example 4:
local result = findImage {imagePath="/var/spirit.png", count=1, fuzzy=0.9, ignoreColors={0x0000ff}};
for i, v in pairs(result) do
    log("x:" .. v[1] .. "y:" .. v[2]);
end

3.2.20. findImageTap {imagePath, count, fuzzy, ignoreColors}

This function is almost the same as the findImage, the difference is findImageTap finds the regions then taps them orderly with 0.016 second interval, and it doesn't return anything.

-- example 1:
findImageTap {imagePath="/var/spirit.png", count=5};

-- example 2:
findImageTap {imagePath="/var/spirit.png", fuzzy=0.6};

-- example 3:
findImageTap {imagePath="/var/spirit.png", ignoreColors={0xffffff, 0x2b2b2b}};

-- example 4:
findImageTap {imagePath="/var/spirit.png", count=1, fuzzy=0.9, ignoreColors={0x0000ff}};
      

3.2.21. appRun(appIdentifier)

Run the app by its identifier.

appRun("com.apple.mobilesafari");
-- run safari

3.2.22. appKill(appIdentifier)

Kill the app by its identifier.

appKill("com.apple.mobilesafari");
-- kill running safari
      

3.2.23. appIsActive(appIdentifier)

Check if the app is active at front most with its identifier.

b = appIsActive("com.apple.mobilesafari");
-- check if the app is active