[Greasemonkey] Macro Programmer Script

Nikolas Coukouma lists at atrus.org
Tue Jan 31 19:27:19 EST 2006


Vincent Chute wrote:
> I had thought for a greasemonkey script that I thought I would ask for 
> opinions on feasiblity.
>
> A macro programmer script which records [user script command to start 
> and stop recording]  a users interaction with a web page [I am think 
> about forms, menus, page modifing javascript links, etc] in terms of 
> events [logged via window during the event "capture" phase] and 
> generates a function to reproduce them which it attaches as a user 
> script command.
>
> I have a vague idea how to do some of it so I was wondering if it 
> sound plausible to people or if anyone had written anything similar 
> before. 
Most of it is pretty easy: you register an event listener on the 
document for each keyboard+mouse event type. As you receive events, 
store them (or at least their pertinent fields) in an array. To run the 
macro, step through the array. Use document.createEvent, then init()-it 
using the stored data, then dispatch it to the old element.

The toughest part is probably recording and restoring the target 
element. Platypus already has some logic for this, as I recall.

Cheers,
-Nikolas


More information about the Greasemonkey mailing list