What is chickenfoot?
====================

Chickenfoot is a Firefox/Iceweasel extension for automating web
browsing tasks. It allows a programmer to easily match patterns
against what browser shows on screen. This is in contrast to
extensions like Greasemonkey where you need to read HTML source code
and depend on possibly automatically generated element names. For more
info see

http://groups.csail.mit.edu/uid/chickenfoot/

What is chickenfoot-launcher?
=============================

Chickenfoot allows user to load a script file and run it but requires
the user to manually start X, browser and click
"Run". chickenfoot-launcher is a wrapper that makes it possible to run
chickenfoot scripts from command line. It uses VNC as a "background X
server" and passes command line arguments to javascript using
temporary files and also lets javascript programs output data to
stdout by using temporary files.

This program is currently a proof-of-concept. If you want to use it
please first become familiar with using VNC since you might
occasionally need to connect to the VNC server to sort things out.

Simple example: hello1.js
-------------------------

hello1.js demonstrates how command line arguments are visible through
ARGV array and how writing to stdoutFile can be used to print text to
stdout:

$ ./chickenfoot-launcher hello.js 1 2 3 "foo bar"
Hello world
My arguments are:
0 : hello.js
1 : 1
2 : 2
3 : 3
4 : foo bar


Slightly more complex example: google1.js
-----------------------------------------

google1.js does a google search query and prints all links found on
the result page:

$ ./chickenfoot-launcher google1.js symbolic model checking
query: symbolic model checking
...
link: <b>Symbolic Model Checking</b>: 10 20 States and Beyond - Burch, Clarke <b>...</b>
...
link: <b>Symbolic model checking</b> for sequential circuit verification <b>...</b>
...

Utterly complex example: halli.js
---------------------------------

halli.js is a script to list and add work hours to halli.tkk.fi. In
its simplest form it reads service username and password from file and
lists work hours:

$ ./chickenfoot-launcher halli.js list ~/.service-auth | lynx -force_html -dump -stdin

Date Project Duration
28.11.2007 Tekninen ylläpito / Technical Maintenance 7,25
21.11.2007 Tekninen ylläpito / Technical Maintenance 7,25
14.11.2007 Tekninen ylläpito / Technical Maintenance 7,25
...

Adding work hours is a bit more complex task.

$ ./chickenfoot-launcher halli.js add ~/.service-auth 2007 12 4 7,25 "9943010002 ATK" "fixed nfs server"

adds 7,25 hours for day 2007-12-04 under category "9943010002 ATK"
with the description "fixed nfs server". You can see the order of
arguments in the usage message you get when you run halli.js without
arguments:

$ ./chickenfoot-launcher halli.js
usage:
chickenfoot-launcher halli.js list authfile
chickenfoot-launcher halli.js add authfile year month day duration category desc

Detailed usage instructions for using chickenfoot-launcher and halli.js on debian squeeze
--------------------------------------------------------------------------------------

1) darcs get http://iki.fi/lindi/darcs/chickenfoot ; cd chickenfoot

2) chmod a+x ./chickenfoot-launcher && ./chickenfoot-launcher

3) ./chickenfoot-launcher for the second time to get the
command to connect to VNC:

No script given, starting browser anyway. You can connect to VNC using
xvncviewer -passwd /home/lindi/.chickenfoot-launcher-home/.vnc/passwd apps2:5

4) xvncviewer -passwd /home/lindi/.chickenfoot-launcher-home/.vnc/passwd apps2:5

5) Go to http://groups.csail.mit.edu/uid/chickenfoot/

6) Follow "Install" and then "Install Chickenfoot" link

7) Click "Edit Options", "Allow" and "Close"

8) Click "Install Chickenfoot" again and then "Install Now"

9) Go to http://halli.tkk.fi/ and click "Ok" when asked if you want to
move to an encrypted page.

10) Close firefox.

11) Test ./chickenfoot-launcher hello.js

12) Put your service username and password separated by a space to a
file named ~/.service-auth and make sure other people can't read it.

13) Test ./chickenfoot-launcher halli.js list ~/.service-auth | lynx -force_html -dump -stdin

14) If all went well, try to add a work hour with something like

./chickenfoot-launcher halli.js add ~/.service-auth 2007 12 4 7,25 "9943010002 ATK" "fixed nfs server"

Using chickenfoot-launcher at niksula
-------------------------------------

1) After step 5) disable java from browser preferences or firefox will crash.

2) Figure out why firefox still often crashes with

The program 'Gecko' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 23374 error_code 2 request_code 53 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
