跳到主要內容

Advance Mode API

Advance Mode:


 

 

getPixel(imageId,x,y,type)

  • return {color string}
type can be "long" or "hex"
eg: for color WHITE, long=16777215, hex=ffffff

eg: getPixel(0, 10,10,"hex");
0 is the screencaptured image id,
get the pixel x=10, y=10 from captured screen, with the result display using hex value

eg: getPixel(getImage("cache",0,50,50,100,100), 10,10,"long");
clip the image from screen capture for the range 50,50, 100, 100
and from that image get the pixel x=10, y=10 from captured screen, with the result display using long value

getJson(httpLink)

  • return {JS Object}

{ "X-Cloud-Trace-Context": "64e17d0cf7ab6e9e8c394dc816617c5f/1407216343458726882", "Upgrade-Insecure-Requests": "1", "Accept-Language": "en-US,en;q=0.5", "Host": "headers.jsontest.com", "DNT": "1", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }

eg:var jsonValue= getJson("http://headers.jsontest.com/");
jsonValue.Host
result="headers.jsontest.com"

openApp(packageName,activityName)

  • void

swipe(x1,y1,x2,y2,time,hold)

  • void
time in millisecond
hold can be "true" or "false"

touch(x,y,time,hold)

  • void
time in millisecond
hold can be "true" or "false"

touch(time)

  • void
time in millisecond

keyAction(action)

  • void
Action can be "home","history","lock","back","stop"

toast(text,location,width,height,lines,time)

  • void
location can be top(49),center(17),Bottom(81),top left(51),top right(53),bottom left(83),bottom right(85)
Time is in millisecond, if set to -1 then it will stay on top

findImage(mainId, templateId, similarity)

  • return JS Array Object{x,y}
Similarity value can be from 1~100
return array object with {x,y}

if not found return ""
example usage
  var loc=findImage();
  loc.points.length
  loc.points[0].x
  loc.points[0].y

getImage(type=file,filePath)

  • return {imageId}
filePath get image from local disk

getImage(type=url,httpLink)

  • return {imageId}
httpLink the http link from the web

getImage(type=cache,imageId,x1,y1,x2,y2)

  • return {imageId}
imageId 0 is the last screen captured imageId

getImage(type=reference,pageId,imageDataIndex,x1,y1,x2,y2)

  • return {imageId}
pageId is a variable

openCV(imageId)

  • return {imageId}
It currently only does canny

ocrText(imageId,language)

  • return {text}
language can be "eng","jpn","kor"

findColor(imageId,type,colors)

  • return {boolean}
type can be "long","hex"
colors need to be use quotation if multi color is added eg:"color1, color2, color3"

showImage(imageId,location,width,height,time)

  • void
location can be top(49),center(17),Bottom(81),top left(51),top right(53),bottom left(83),bottom right(85)
Time is in millisecond, if set to -1 then it will stay on top

saveImage(imageId,filePath,format,compressLevel)

  • return {file name}
filePath the path start from your sdcard directory
format can be "png" or "jpg"
compressLevel 1~100 only works on jpg format

beep()

  • void
Play a beep sound

wifi(value)

  • void
value can be set to "true" or "false"

setClip(text)

  • void
text that you want to save to clipboard

getClip()

  • return {text}
get text value from the clipboard

isImageExit(imageId)

  • return {boolean}
check if image is exist in cache

copyImageToIndex(cache_imageId, new_imageId_index)

  • VOID
copy cache image to new index

removeImage(imageId)

  • void
the image that you want to remove from cache

留言

這個網誌中的熱門文章

Alternative Daemon Service

Accessibility Service Download Google Play : >> https://play.google.com/store/apps/details?id=com.autoit.nonroot.accessibility Video Instruction For Android Device 7.0+  - 123Autoit NON ROOT >> https://play.google.com/store/apps/details?id=com.autoit.nonroot - Pretouch Semi auto >> https://play.google.com/store/apps/details?id=com.autoit.pretouch now enable to work without Daemon Service without computer updated: faster and lighter   Newer version: added UI interaction     for 123Autoit nonROOT click to open click open accessibility turn on the 123Autoit Accessibility click on three dots click on three strips check the check box Alternative Service Android 7.0+ and download the apk and install For Pretouch Semi Auto  Open pretouch semi auto click on the blue circle click on Edit

123Autoit nonroot tutorial

Background Info: This App doesn't require Root Permission, it works by setting up Page with Checkpoints and Action with SC(screen captured images), if all checkpoints matched then it will trigger Action. So CheckPoint and Action, to create a complete Automation Flow, pages with checkpoints and Action in it. Assumption your device is start the Accessibility Service and your android version is 7.0 or above For General Question: check out here if not please start take a look here for android Device 7.0 or above (no Computer required) http://123autoit.blogspot.com/2016/08/123autoit-non-root-daemon-service.html for android device Under 7.0 (which require Computer to complete the setup) http://123autoit.blogspot.com/2016/08/123autoit-non-root-daemon-service.html All Test is done using this app. or you can use any other app, it would work the same. https://play.google.com/store/apps/details?id=com.test.automate 1 tutorial: when see this title Red rectangle in th

Revamp Basic tutorial

Assume that you have started the daemon service, and install the 123Autoit- nonRoot and everything is working in order. So here is what you need to do, think of a process you want to perform, and on what application, and under what situation. 1)       Start up the 123Autoit-nonroot, you should be able to see floating buttons on the top right corner. 2)       Start up an app you want to automate 3)       On the floating buttons, click the “…” buttons to reveal the sub menu Click the “SC” button to perform a screen capture on the current active app, in my case, I am currently on a Built in Launcher. And Wait(screen capture does take times depends on your device performance) 4)       It should take you to the Edit mode 5)       So first we need to add Check points to define current page, Swipe out the Left Menu and select the Group B 2 nd option(Coord Col Match) What it does, it checks the checkpoint image pixel against the screen image, if