[Greasemonkey] automate with Firefox?

Prakash Kailasa pk-moz at kailasa.net
Wed Jul 6 12:29:25 EDT 2005

On Wed, Jul 06, 2005 at 04:52:19AM -0700, Jason Green wrote:
> Since there is a script to automatically log you into MySpace, is it 
> possible to write something that would then automate tasks? Example, 
> it'd log into myspace and leave a text message in each of the friends 
> comment box.

Yes. It is possible to do something like this, if you can uniquely
identify each page (maybe a form name, or any element that is guaranteed
to be on each page and that page only).

Your script would basically look like this:

if (on_page_1) {
} else if (on_page_2) {
} else {

It gets ugly (I don't much like this if-elseif-elseif-...-else
pattern) if you have a lot of pages to deal with, but for a small set
it should be ok.

[I wrote a very small script at work to skip a couple of annoying
pages every time I login to an application. All you ever do is click
on one of many possible links to choose an option and you go to the
next page.  This was one of my earliest scripts. Later I enahanced the
script by using GM_*Value (to let users select the default option) and
GM_registerMenuCommand (toggle skipping on/off). It has become quite a
must-have among my co-workers.]


|In the future, you're going to get computers as prizes in breakfast   |
|cereals.  You'll throw them out because your house will be littered   |
|with them.                                                            |

More information about the Greasemonkey mailing list