Skip to content

Instantly share code, notes, and snippets.

View kentkrantz's full-sized avatar
🎯
Focusing

ByteMind kentkrantz

🎯
Focusing
View GitHub Profile
// import functions from the main module of AutoTouch
const { getColors, getColor } = at
// getColor(x, y)
const [result, error] = getColor(100, 200)
if (error) {
alert('Failed to get color, error: %s', error)
} else {
alert('Got result by getColor', result);
}
// import functions from the main module of AutoTouch
const { findColors, findColorsAsync } = at
// Prepare parameters
const params = {
colors: [ // Required parameter
{ color: 16661296, x: 0, y: 0 },
{ color: 1751033, x: -53, y: 67 },
],
count: 3, // optional, default is 0, 0 means no limitation
// import screenshot function from module at
const { screenshot } = at
// Take screenshot without parameters.
// Without parameter `savePath`, it will save the image to your iOS Album
screenshot()
// or
at.screenshot()
// Specify savePath parameter to take scsreenshot.

Keybase proof

I hereby claim:

  • I am kentkrantz on github.
  • I am kentkrantz (https://keybase.io/kentkrantz) on keybase.
  • I have a public key ASBxfwbVBo6M1XyXmC1M5DRkyhZPnJkfWEmxKsuXKVF-TQo

To claim this, I am signing this object:

@kentkrantz
kentkrantz / lundum_lua535_compatible_32bit_64bit_bytecode.c
Last active September 12, 2018 02:18 — forked from xebecnan/lundump_lua53_load_x32_bytecode_on_x64.c
lua5.3.5 compatible 32bit and 64bit bytecode
/*
** $Id: lundump.c,v 2.44.1.1 2017/04/19 17:20:42 roberto Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/
#define lundump_c
#define LUA_CORE
#include "lprefix.h"
@kentkrantz
kentkrantz / test_findColors.lua
Last active July 25, 2018 17:44
Test getColors/findColors of AutoTouch
function table.val_to_str ( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or
tostring( v )
@kentkrantz
kentkrantz / table_tostring.lua
Last active November 18, 2020 09:32
Convert lua table to string
function table.val_to_str ( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or
tostring( v )