操作ガイド

1. 概括
2. 使い方
3. スクリプト

1. 概括

AutoTouchはモバイルデバイスでの様々なタッチとクリック操作を記録し、再生することができる。また、事前にLuaスクリプト言語で作ったスクリプトを実行し、人間のタッチ操作をシミュレートすることによって、より多くの予想外の機能を実現することもできる。例えば、自動的にゲームをやり始め、猛獣を倒してお金を稼ぐ、大量の写真を一緒に編纂する、プログラムの自動化テストへ入る或いは自動的にメールアドレスにログインするなど。

現在、AutoTouchはすでに多くの人々の操作を記録して再生する能力を持っている。例えば、タッチ、実体のホームボタンや音量ボタンや声のスイッチボタンやロックボタンをクリックするなど。しかも、正確かつスムーズにできる。また、キャプチャー、一部の画面のキャプチャー、カラールックアップ、カラーマッチング、画像マッチングなどの拡張関数を提供し、更に大きな発掘可能の潜在能力を備えている。これらの特異な能力を組み合わせると、あなたを束縛できるのは想像力だけになる。

2. 使い方

2.1. どのようにインストールするか?

  1. CydiaにBigBossのソースを添加したことを確かめる;
  2. Cydiaの中でAutoTouchを探し出してインストールする;
  3. 今までにActivatorをインストールしたことがない場合、AutoTouchをインストールすると同時に、自動的にこのジェスチャーコントロール用のプラグインをインストールする。それをアンインストールしないことを進める。さもなければ、AutoTouchも一緒にアンインストールされる。

2.2. どのように録画するか?

  1. 録画を開始したいインタフェースで、音量ダウンボタン(あるいは設定した他のActivatorコントロール動作)を長押しして、コントロールパネルをポップアップする。コントロールパネルに録画ボタンとスクリプトリストがある;
  2. コントロールパネルの上の「収録」ボタンをクリックすると、震動で録画の開始を提示する;
  3. 次はやりたいタッチや他の操作をしてください、例えば猛獣倒しなど;
  4. 録画を止めたい時、「録画終了」のヒントボックスがポップアップまで音量ダウンボタン(或いは前述の他のコントロール動作)を長押しして、震動で録画の終了を提示する;
  5. 次は、AutoTouchでさっき収録したスクリプトをチェックして、管理や放送できる。スクリプトはデフォルトで作成時間を名称とする、よりわかりやすい名前になるように修正することもできる。

2.3. どのように再生するか?

  1. 再生したいインターフェースで、音量ダウンボタン(あるいは設定した他のActivatorコントロール動作)を長押しして、コントロールパネルをポップアップする;
  2. コントロールパネルで再生したいスクリプトをクリックする;
  3. 次は、再生回数、間隔と速度を聞く再生設置のダイアログボックスが出てくるのは普通である。(スクリプトを直接に再生すると設置したことがある場合を除く);
  4. 「ただちに実行」をクリックすると、さきほどの設置によってすぐに再生を行い、震動で開始を提示する。再生終了後、自動的に停止し、終了のダイアログをポップアップする(設置でダイアログの提示を閉じることができる)。音量ボタンを長押しして(或いは前述の動作)再生を中断することもできる;
  5. もし、「後に実行」をクリックする場合、準備するという状態に入る。この状態では、音量ダウンボタンをクリック(長押しではない、修正できない)することによって、繰り返しに起動したり再生を中断したりことができる。しかも問い合わせダイアログボックスが出てこなくなり、再びあなたを中断していない。再び、長押し(或いは前述の動作)して、準備するという状態を閉じる;
  6. あなたは、「再生設置」のインターフェースでスクリプトを直接に再生すると設置し、デフォルトの再生設置を設置する。こうしてこのスクリプトを選ぶと、直接に設置のままに再生し、再生設置の問い合わせダイアログボックスがで二度と出てこない。

2.4. スクリプトをどのように書くか?

  1. ツールバー中間の「アクション」ボタンを押して、「新規ファイル」を选択すれば、新しいスクリプトウィンドウが開ける;
  2. スクリプトの編集インタフェースでコードを書く;
  3. 「保存」ボタンをクリックして名称を入力保存する。

2.5. どのようにスクリプトを暗号化するか?

  1. AutoTouchでスクリプトをクリックして、「暗号化」を選ぶ;
  2. 暗号化パスワードを入力し、パスワードの間に空白のままでいい;
  3. 「確定」をクリックして暗号化を完了する。同時に同名だが、 lua.eで終わる暗号化ファイルが生成する;
  4. 暗号化したスクリプトを選択し、再生できる。パスワードがない場合、ヒントによってパスワードを入力すればいい。

2.6. コンピュータ上でスクリプトを管理する方法?

  1. あなたは、設定インターフェイスのWebサーバを開き、ブラウザのURLを介してコンピュータ上のプロンプトにアクセスし、その後、スクリプトを編集することができ;
  2. また、インターフェイスを設定する際にWebDAVサーバーを開くことができますし、コンピュータ上のアドレスWebDAVクライアントソフトウェアによってプロンプト接続するために、そして、あなたは、スクリプトを編集することができます;

2.7. どのように権限を購入するか?

  1. 「設定」インターフェースの「授権」ボタンをクリックして、授権情報インタフェースを開く;
  2. 授権情報インタフェースを開くと、授権の検証を行う;
  3. 授権の検証が失敗する場合、支払いボタンが出てくる;
  4. 支払いボタンをクリックして、ブラウザウィンドウへ移り、支払いページが開く。alipayのユーザーは是非支払いページの「支払い説明」に設備のシリアル番号に貼り付けてください;
  5. 支払いが完了後、「設定」のインターフェースで「授権」をクリックして検証する;
  6. 授権が検証される後、無限の再生時間と全部の機能が獲得できる。

2.8. ショップからどのようにスクリプトをダウンロードし、購入するか?

  1. 直接ショップからすべてのスクリプトをダウンロードすることができる;
  2. 暗号化したスクリプトもあるので、、作者と連絡してパスワードを購入する必要がある;
  3. スクリプトがダウンロードされる後、スクリプトリストに保管する。他のスクリプトのように直接に使用することができる。

2.9. どのようにスクリプトをショップ内に発表するか?

  1. 共有や販売するために、ショップにスクリプトを公開することができる;
  2. ただスクリプトを分かち合いたい場合、直接に. luaファイルをアップロードすればいい。他人に内容を見られたくないなら、パスワードなしの暗号化ができる;
  3. ショップでスクリプトを売り出したい場合、スクリプト暗号化し、パスワードを設定することができる。このようにして、スクリプトを必要としている人はあなたと連絡してパスワードを購入する。

3. スクリプト

3.1. 基礎

Lua Official Reference Manual でLua言語の使用を勉強することができる.


3.2. 拡張関数

拡張関数はLua言語の広がりに使うものである。アナログ人間が携帯電話を操作すると同じいくつかの機能を備えさせる。また、キャプチャー、一部の画面のキャプチャー、カラールックアップ、カラーマッチング、画像マッチングなどの機能も提供する。


touchDown(id, x, y)

在スクリーンの(x, y)座標を押す。

touchDown(0, 100, 200); -- 座標(100, 200)のところで押す。

touchMove(id, x, y)

指を(x, y)座標に移動する。

touchDown(0, 100, 200); -- 座標(100, 200)のところで押す。
touchMove(0, 200, 200); -- 指を座標(200, 200)に移動する。

touchUp(id, x, y)

(x, y)座標から押した指を挙げる。

touchDown(0, 100, 200); -- 座標(100, 200)のところで押す.
touchMove(0, 200, 200); -- 指を座標(200, 200)に移動する.
touchUp(0, 200, 200); -- 座標(200, 200)のところで押した指を挙げる.

tap(x, y)

座標点(x、y)をクリックする.

tap(100, 200); -- 座標(100, 200)をクリックする.

keyDown(keyType)

Simulate a key button down event.

keyDown(KEY_TYPE.HOME_BUTTON);
-- Simulate a home button down event.

-- how to make a key press
function keyPress(keyType)
    keyDown(keyType);
    usleep(10000);
    keyDown(keyUp);
end

keyPress(KEY_TYPE.HOME_BUTTON);

keyUp(keyType)

Simulate a key button up event.

keyUp(KEY_TYPE.HOME_BUTTON);
-- Simulate a home button up event.

getColor(x, y)

現在のスクリーンで指定した座標の色情報を得る.

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

findColor(color, count, region)

現在のスクリーですべての指定した色とマッチングする座標点を取得する。.注意すべきのは、このようにfind(rgb=0x0000ff、カウント=5)を使うではなく、find(0x0000ff、5)を使うべきである。findImageのパラメータは全体としてtableであるため、findImage関数と違っている.

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

-- 例 2:
local result = findColor(0x00ddff, 0, {100, 50, 200, 200});
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

-- 例 3:
local region = {100, 50, 200, 200};
local result = findColor(0x00ddff, 0, region);
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

findColors(colors, count, region)

Find all the regions(rectangles) contain the specified colors and fit their relative positions on the screen, return the center coordinates of the regions as table. You can use the count parameter to limit the result number of finding, pass in 0 if no limit, and use region to limit the region of finding, pass in nil if no limit.

There is a powerful help tool in the script edit view, click on the "Extensions" to open the function list, click "HELPER" besides the findColors function, it will ask you to choose and open a screenshot from the album, zoom in the screenshot till the pixels are clear, click on the pixels you want to mark as anchor points, then it will get the colors and their relative positions, it will construct the "colors" parameters while you are marking, it's very intuitionistic.

-- example 1:
local result = findColors({{0x00ddff,0,0}, {0x00eeff,10,10}, {0x0000ff,0,20}}, 2, nil);
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

-- example 2:
local colors = {{0x00ddff,0,0}, {0x00eeff,10,10}, {0x0000ff,0,20}};
local result = findColors(colors, 0, nil);
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

-- example 3:
local colors = {{0x00ddff,0,0}, {0x00eeff,10,10}, {0x0000ff,0,20}};
local region = {100, 50, 200, 200};
local result = findColors(colors, 0, region);
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

findImage(imagePath, count, fuzzy, ignoreColors, region)

Find the regions similar to the specified image on the screen, return the center coordinates of the regions as table. ATENSION: from AutoTouch v3.1.1 on, the parameter of findImage is not a table as the old versions before anymore, you have to pass in the parameters one by one, event you don't want , you shold pass in the default value, such as 0, nil, etc.

-- example 1:
local result = findImage("images/spirit.png", 5, 1, nil, nil);
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end
 
-- example 2:
local result = findImage("images/spirit.png", 0, 0.6, nil, nil};
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end
        
-- example 3:
local result = findImage("images/spirit.png", 0, {0xffffff, 0x2b2b2b}, nil};
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end
          
-- example 4:
local region = {100, 50, 200, 200};
local ignoreColors = {0xffffff, 0x2b2b2b};
local result = findImage("images/spirit.png", 1, 0.9, ignoreColors, region};
for i, v in pairs(result) do
    log("x:" .. v[1] .. ", y:" .. v[2]);
end

findColorTap(color, count, region)

この関数はfindColorとほぼ同じ、違いはfindColorTapがそれらの点を見つけて順番に0.016秒の間隔を置いてクリックし、それに何の値も戻らない.

-- 例 1:
findColorTap(0x0000ff, 2, nil); -- 色が0x0000ffである最初の二つの座標点を見つけて順番に0.016秒の間隔を置いてクリックする.

-- 例 2:
local region = {100, 50, 200, 200};
findColorTap(0x0000ff, 0, region);

findColorsTap(colors, count, region)

As it looks like, this function finds out the regions (totally same as findColors does we've talked about before), and tap them a time one by one with 0.016 second interval. It's parameters are totally the same as findColor function, and it doesn't return anything.

findColors({{0x00ddff,0,0}, {0x00eeff,10,10}, {0x0000ff,0,20}}, 2, nil); -- find out the first two regions fit the specified colors and their relative positions, then tap them a time one by one.

local region = {100, 50, 200, 200};
findColors({{0x00ddff,0,0}, {0x00eeff,10,10}, {0x0000ff,0,20}}, 2, region); -- find out all the regions, then tap them a time one by one.

findImageTap(imagePath, count, fuzzy, ignoreColors, region)

As it looks like, this function finds out the regions (totally same as findColor does we've talked about before), and tap them a time one by one with 0.016 second interval. It's parameters are totally the same as findColor function, and it doesn't return anything.

local region = {100, 50, 200, 200};
local ignoreColors = {0xffffff, 0x2b2b2b};
findImageTap("images/spirit.png", 1, 0.9, ignoreColors, region};

findImageTap(imagePath, count, fuzzy, ignoreColors, region)

関数ととほぼ同じで、違いはあれらの区域をそして順次0.016秒間隔をクリックし、任意の値に戻る。この関数はfindImageとほぼ同じ、違いはfindImageTapがそれらの区域を見つけて順番に0.016秒の間隔を置いてクリックし、それに何の値も戻らない.

local region = {100, 50, 200, 200};
local ignoreColors = {0xffffff, 0x2b2b2b};
findImageTap("images/spirit.png", 1, 0.9, ignoreColors, region};

screenshot(filePath, {x, y, width, height})

Take a screenshot of the whole screen or just a region and save it to the specified file path.

screenshot ("images/screenshot1.png", nil);
-- Take a screenshot and save it to the specified path.
          
screenshot ("images/screenshot1.png", {100, 100, 200, 200});
-- Take a screenshot of region(100, 100, 200, 200) and save it to the specified path.

appRun(appIdentifier)

appIdentifierで指定するアプリを起動する.

appRun("com.apple.mobilesafari");
-- Safariを実行する
      

appKill(appIdentifier)

appIdentifierで指定するアプリを終了する.

appKill("com.apple.mobilesafari");
-- 実行しているSafariを終了する
      

appState(appIdentifier)

get the state of the specified app with its identifier.

b = appState("com.apple.mobilesafari");
-- get the state of Safari.
      

appIsActive(appIdentifier)

検査指定するアプリは活躍している或いは開いた状態にあるかどうかを検査する.

b = appIsActive("com.apple.mobilesafari");
-- アプリの開く状態を検査する
      

rootDir()

スクリプト保存のデフォルトアドレスを得る.

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

usleep(microseconds)

何マイクロ秒を中止する、つまり1/1000000秒.

usleep(1000000);
-- 1秒中止する

log(logContent)

日誌を記録する、日誌のインターフェース見ることができる。

log("play here...");

alert(message)

ダイアログボックスをポップアップし、指定内容を示す.

alert("Hello world!");

vibrate()

一回振動する.

vibrate(); -- 一回振動する.

playAudio(audioFile, times)

Play the specified audio file, times means how may time you want to play, default is 0, means infinitely.

playAudio("/var/audio.mp3", 0); -- play infinitely.

pauseAudio()

Pause the playing started before.

pauseAudio();

resumeAudio()

Resume the paused playing before.

resumeAudio();

stopAudio()

Stop the playing started before.

stopAudio();

getScreenResolution()

画面解像度を得る.

local w, h = getScreenResolution();
-- 解像度の幅は1136、高さは640である.

getScreenSize()

画面の大きさを取得する。ここはアップル座標係の大きさを指している。画面解像度割る2はRetinaディスプレイとなる.

local width, height = getScreenSize();
-- iPhone 5:幅は320、高さは568である

getScreenScale()

Get the retina scale of the screen.

local scale = getScreenScale();
-- 2.0 for iPhone 5, 3.0 for iPhone 6 Plus.

getScreenBitDepth()

Get the bit depth of the screen.

local bitDepth = getScreenBitDepth();

getSN()

デバイスのシリアル番号を取得します。

b = getSN();
          -- b: C15NFK32TWD2
      

getVersion()

AutoTouchの現在のバージョンを取得します。

b = getVersion();
          -- b: 3.0.1
      

intToRgb(intColor)

R、G、Bタイプにカラー値のint型に変換する。

local r, g, b = intToRgb(0x2b2b2b);

rgbToInt(r, g, b)

整数型にカラー値のRGBタイプに変換します。

local intColor = rgbToInt(200, 255, 100);

copyText(text)

後で使用することができ、クリップボードに指定されたテキストをコピーします。

copyText("This is a copied text!");

clipText()

Get the text on the clipboard.

local text = clipText();

inputText(text)

Input the specified text to the focused text field.

inputText("Let's input some text automatically without tapping the keyboard!");
inputText("\b\b\b"); -- delete backward for 3 characters 

fakeLocation(appIdentifier, latitude, longitude)

Fake geographic position for the specified apps, it remains in effect until you call clearFakeLocation, or clear the faking in the settings view.

fakeLocation("com.apple.Maps", 36, 50);  -- fake location for Apple Map. 

clearFakeLocation(appIdentifier)

Clear the location faking for one specified app.

clearFakeLocation("com.apple.Maps");  -- clear the location faking for Apple Map.

dialog(controls, enableRemember)

Show a dialog accepts user input.

local label = {type=CONTROLLER_TYPE.LABEL, text="Would you mind to provide some personal informations?"}
local nameInput = {type=CONTROLLER_TYPE.INPUT, title="Name:", key="Name", value="Kevin"}
local positionPicker = {type=CONTROLLER_TYPE.PICKER, title="Position:", key="Position", value="CEO", options={"CEO", "CTO", "CFO", "CXO"}}
local developerSwitch = {type=CONTROLLER_TYPE.SWITCH, title="A Developer:", key="ADeveloper", value=1}

local controls = {label, nameInput, positionPicker, developerSwitch}
local enableRemember = true;

dialog(controls, enableRemember);

alert(string.format("name:%s, birthday:%s, gender:%d", nameInput.value, positionPicker.value, developerSwitch.value))
      

getOrientation()

Get the screen orientation.

local o = getOrientation();
      

3.3. Key Types
3.4. Dialog Control Types
3.5. Screen Orientation Types