Document
1. General
2. Usage
3. Script
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.
- Make sure you've added the BigBoss source to the Cydia;
- Search and install "AutoTouch" from Cydia;
- It will install the dependent app "Activator" automatically, which is used for control management. Do not remove "Activator" or it will remove "AutoTouch" together.
- 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;
- Click on the "Record" button, it will start recording immediately with a shot vibrating;
- Then do your touch or other operations;
- 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;
- 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.
- 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;
- Click on the script that you want to play;
- 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;
- 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;
- 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;
- 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.
- Click the "Action" button at middle of the toolbar, then choose "New File";
- Write in the edit view to make your script;
- Then click the "Save" button to save it.
- Click on the script in AutoTouch, select the "Encrypt" option;
- Input the password, if you don't want a password just leave it blank.
- Confirm to encrypt it, then it will generate a file with the same name but .lua.e suffix.
- You can play the encrypted scripts just as playing .lua scripts, if it ask for password just input it.
- Click the "Action" button at middle of the toolbar, choose the "Upload" button to open the upload view;
- Open the url provided in the upload view with the web browser from you computer;
- Then you can upload and manage your scripts and other files from the browser.
- Click on the "License" in the "Settings" view to open the license infomation view;
- It will validate you license when open the license infomation view;
- If you are not validated, you will find the "Pay with Paypal" button, just click on it;
- Then you will switch to the Safari browser window, finish the payment on Paypal official payment site, it is safe;
- 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;
- When the license is validated, you will have all the features of the app.
- You can download any script from the store directly;
- 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;
- Downloaded scripts are in the script list, use them as others.
- You can release your scripts in the store to share or sell to others;
- 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;
- 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.
You can learn lua from Lua Official Reference Manual to know how to use it.
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.
touch on the point(x, y) and set the event id.
- Params
- id: the id you speficified for this event.
- x: the x-coordinate you want to touch down at.
- y: the y-coordinate you want to touch down at.
- Return
- Examples
touchDown(0, 100, 200); -- touch down at point(100, 200).
touch move to the point(x, y).
- Params
- id: the id your touch continues from.
- x: the x-coordinate you want to touch move to.
- y: the y-coordinate you want to touch move to.
- Return
- Examples
touchDown(0, 100, 200); -- touch down at point(100, 200).
touchMove(0, 200, 200); -- touch move to point(200, 200).
touch up from the point(x, y).
- Params
- id: the id your touch continues from.
- x: the x-coordinate you want to touch up from.
- y: the y-coordinate you want to touch up from.
- Return
- Examples
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).
tap at the point(x, y).
- Params
- x: the x-coordinate you want to tap at.
- y: the y-coordinate you want to tap at.
- Return
- Examples
tap(100, 200); -- tap at point(100, 200).
Simulate a home button down event.
homeButtonDown();
-- Simulate a home button down event.
Simulate a home button up event.
homeButtonUp();
-- Simulate a home button up event.
Get the root path of the dir you place the scripts in.
- Params
- Return
- The path string of the root dir.
- Examples
local dirPath = rootDir();
-- dirPath = "/var/mobile/Library/AutoTouch/Scripts/"
Sleep the process for microseconds.
- Params
- microseconds: the time you want to sleep for.
- Return
- Examples
usleep(1000000);
-- Sleep one second
Take log of the string type log content.See log in the log view
- Params
- logContent: the content you want to log.
- Return
- Examples
log("play here...");
Open an alert view to show the message.
- Params
- message: the message you want to show with alert view.
- Return
- Examples
alert("Hello world!");
Take a vibration.
vibrate();
-- Take a vibration for a time.
Take a screenshot and save it to the specified file path.
- Params
- filePath: The path that you want the screenshot be saved
- Return
- Examples
screenshot("/var/screenshot1.png");
-- Take a screenshot and save it to the specified path.
Take a screenshot and save it to the specified file path.
- Params
- filePath: The path that you want the screenshot be saved
- x: the top-left x-coordinate in iOS coordinate system of the region you want to take the screenshot.
- y: the top-left y-coordinate in iOS coordinate system of the region you want to take the screenshot.
- width: the width in iOS coordinate system of the region you want to take the screenshot.
- height: the height in iOS coordinate system of the region you want to take the screenshot.
- Return
- Examples
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.
Get the resolution of your device screen.
- Params
- Return
- width: The width resolution of your device.
- height: The height resolution of your device.
- Examples
local w, h = getScreenResolution();
-- width is 1136, height is 640 for iPhone 5
Get the size of your device screen in iOS coordinate system.
- Params
- Return
- width: The width of your device screen.
- height: The height of your device screen.
- Examples
local width, height = getScreenSize();
-- width is 320, height is 568 for iPhone 5
Get the RGB color value of the specified point on the screen.
- Params
- x: the x-coordinate in iOS coordinate system of the point you want to get the color.
- y: the y-coordinate in iOS coordinate system of the point you want to get the color.
- Return
- rgb: the rgb value of the color.
- Examples
local rgb = getColor(100, 200);
alert("rgb:" .. rgb);
-- rgb:16777215
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.
- Params
- rgb: the int type rgb value of the color. (REQUIRED)
- count: how many no more than you want to find out, default is 0, means all the fit ones in the screen should be found.count=1 means only the first fit one should be found, count=2 means the first two should be found.It will be faster when you set this parameter to a small value. (OPTIONAL).
- Return
- locations: the locations of the points these fit the specified color. Looks like {{x1, y1}, {x2, y2}, ...}.
- Examples
local result = findColor(0x0000ff, 2);
for i, v in pairs(result) do
log("x:" .. v[1] .. "y:" .. v[2]);
end
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.
- Params
- rgb: the int type rgb value of the color. (REQUIRED)
- count: how many no more than you want to find out, default is 0, means all the fit ones in the screen should be found.count=1 means only the first fit one should be found, count=2 means the first two should be found.It will be faster when you set this parameter to a small value. (OPTIONAL).
- Return
- Examples
findColorTap(0x0000ff, 2); -- find the first two coordinates which's' color is 0x0000ff, then tap them.
Find the regions similar to the specified image on the screen, return the top-left coordinates of the regions as table.
- Params
- imagePath: the path of the small image you want to find out from the screen, such as the spirit image in the game. (REQUIRED)
- count: how many no more than you want to find out, default is 0, means all the fit ones in the screen should be found.count=1 means only the first fit one should be found, count=2 means the first two should be found.It will be faster when you set this parameter to a small value. (OPTIONAL).
- fuzzy: the degree of fuzzy matching when finding, default is 1, means match exactly, fuzzy=0.5 means match 50%. (OPTIONAL)
- ignoreColors: array(table in lua) type of colors will be ignored when finding. (OPTIONAL).
- Return
- locations: the top-left coordinates of the regions these similar to the specified image. Looks like {{x1, y1}, {x2, y2}, ...}.
- Examples
-- 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
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.
- Params
- imagePath: the path of the small image you want to find out from the screen, such as the spirit image in the game. (REQUIRED)
- count: how many no more than you want to find out, default is 0, means all the fit ones in the screen should be found.count=1 means only the first fit one should be found, count=2 means the first two should be found.It will be faster when you set this parameter to a small value. (OPTIONAL).
- fuzzy: the degree of fuzzy matching when finding, default is 1, means match exactly, fuzzy=0.5 means match 50%. (OPTIONAL)
- ignoreColors: array(table in lua) type of colors will be ignored when finding. (OPTIONAL).
- Return
- Examples
-- 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}};
Run the app by its identifier.
- Params
- appIdentifier: the identifier of the app you want to run, such as "com.apple.mobilesafari". (REQUIRED)
- Return
- Examples
appRun("com.apple.mobilesafari");
-- run safari
Kill the app by its identifier.
- Params
- appIdentifier: the identifier of the app you want to kill, such as "com.apple.mobilesafari". (REQUIRED)
- Return
- Examples
appKill("com.apple.mobilesafari");
-- kill running safari
Check if the app is active at front most with its identifier.
- Params
- appIdentifier: the identifier of the app you want to check, such as "com.apple.mobilesafari". (REQUIRED)
- Return
- ifAppIsActive: bool type result.
- Examples
b = appIsActive("com.apple.mobilesafari");
-- check if the app is active