Skip to content
wookay edited this page Dec 6, 2012 · 29 revisions
~/libcat/script$ ./console.rb
ls TARGET           : list target object (l)        help     : help (h)
  > ls              : list current object           quit     : quit (q)
  > ls -r           : list recursive                about    : about libcat Console
cd TARGET           : change target object          clear    : clear the screen
  > cd              : to topViewController          history  : input commands history
  > cd .            : to self                       sleep N  : sleep N seconds
  > cd ..           : to superview
  > cd /            : to rootViewController         class introspection
  > cd ~            : to keyWindow                    > classInfo TARGET (c)
  > cd ~~           : to UIApplication                > methods TARGET (m)
  > cd 0            : at index as listed              > classMethods TARGET (M)
  > cd 1 0          : at section and row              > ivars TARGET (i)
  > cd Title        : labeled as Title                > protocols TARGET
  > cd view         : to property                     > UIApplication
  > cd UIButton     : to class                        > UITableViewDelegate
  > cd 0x6067490    : at memory address             enum ENUMTYPE            : enum type info
pwd                 : view & controller hierarchy     > enum UIInterfaceOrientationPortrait
properties TARGET   : list properties (p)             > enum UIInterfaceOrientation
  > text            : property getter               map ARGS
  > text = hello    : property setter                 > view.subviews.map text frame.size
watch KEYPATH       : watch property keypath (w)    events (USE_PRIVATE_API) : list touch events (e)
flick TARGET        : flick target UI (f)             > events record        : record on/off (er)
touch TARGET        : touch target UI (t)             > events play          : play events (ep)
back                : popViewController UI (b)        > events cut N         : cut N events (ex)
drag TARGET         : drag target UI (d)              > events clear         : clear events (ec)
rm TARGET           : removeFromSuperview UI          > events replay NAME   : replay events (ee)
png TARGET          : capture target as image UI      > events save NAME     : save events (es)
open                : open Safari UI (o)              > events load NAME     : load events (el)

Object Navigation

  • ls TARGET
  • cd TARGET
  • pwd

TARGET

> cd .            : to self            
> cd ..           : to superview       
> cd /            : to rootViewController
> cd ~            : to keyWindow
> cd ~~           : to UIApplication
> cd 0            : at index as listed          
> cd 1 0          : at section and row
> cd -1 0         : at index on toolbar
> cd Title        : labeled as Title   
> cd view         : to property        
> cd UIButton     : to class           
> cd 0x6067490    : at memory address      

Properties

> properties
> text
> backgroundColor
> view.frame.size
> text = hello
> backgroundColor = redColor
> alpha = 0.5
> view.frame = {{0, 0}, {320, 416}}

Observe KeyPath

> watch
> watch title
> watch view.frame

Class Introspection

> classInfo TARGET (c)
> methods TARGET (m)
> classMethods TARGET (M)
> ivars TARGET (i)
> protocols TARGET
> UIApplication
> UITableViewDelegate

map ARGS

> view.subviews.map text frame.size
> view.subviews.map frame subviews.count

Show UIViews on Web Browser

  • open

UI commands

  • flash (f)
  • touch (t)
  • back (b)
  • drag (d)
  • rm TARGET
  • png TARGET

Automation Script

require './console'
c = Console.new
c.input 'ls'
c.input 'view.backgroundColor = greenColor'
  • script/test_script.rb

UI Events Recorder

> events                 : list touch events (e)
> events record        : record on/off (er)
> events play          : play events (ep)
> events cut N         : cut N events (ex)
> events clear         : clear events (ec)
> events replay NAME   : replay events (ee)
> events save NAME     : save events (es)
> events load NAME     : load events (el)
  • USE_PRIVATE_API=1

Examples