Two (hopefully) simple questions

64 views
Skip to first unread message

Thoric

unread,
Apr 11, 2012, 7:44:39 PM4/11/12
to autoke...@googlegroups.com
I'm new to AutoKey, and it seems super-useful, but I'm having some trouble with the basics of some more advanced usage, and cannot seem to find some examples of doing these things:

1) I'd like to make a simple script to take control of Firefox.  I've figured out how to activate() an existing Firefox window, and also how to launch an instance of Firefox, but once I do that, how do I make Firefox do what I want?  For example, how do I make Firefox load a particular URL, say for example "http://www.google.com/", and then once I do that, how would I inject a search term and click "search"?   This seems like basic stuff, but unless I'm blind, there are no examples of doing something like that.

2) I'd also like to be able to run one of these python scripts from the shell, external to AutoKey.  I tried using "from autokey import *", but I can't get access to "window".  It would be kind of cool if for example I could execute a shell script from bash to do something such as launch a web browser, log you into Facebook and update your status.  I know that AutoKey is just the tool for this, but I'm getting stuck every step of the way...

Thanks in advance :)

Luke Faraone

unread,
Apr 11, 2012, 7:48:21 PM4/11/12
to autoke...@googlegroups.com
On 11/04/12 19:44, Thoric wrote:
> 1) I'd like to make a simple script to take control of Firefox. I've
> figured out how to activate() an existing Firefox window, and also how
> to launch an instance of Firefox, but once I do that, how do I make
> Firefox do what I want? For example, how do I make Firefox load a
> particular URL, say for example "http://www.google.com/", and then once
> I do that, how would I inject a search term and click "search"? This
> seems like basic stuff, but unless I'm blind, there are no examples of
> doing something like that.

Start "firefox http://google.com/search?q=YOUR_SEARCH_TERM_HERE" from
your script. Alternatively, from within Firefox do CTRL+T then CTRL+L
and paste your URL. (The CTRL+L may be redundant)
Wait, then paste your term, then hit return.

> 2) I'd also like to be able to run one of these python scripts from the
> shell, external to AutoKey. I tried using "from autokey import *", but
> I can't get access to "window". It would be kind of cool if for example
> I could execute a shell script from bash to do something such as launch
> a web browser, log you into Facebook and update your status. I know
> that AutoKey is just the tool for this, but I'm getting stuck every step
> of the way...

I don't think this is supported.

--
Luke Faraone;; Debian & Ubuntu Developer; Sugar Labs, Systems
lfaraone on irc.[freenode,oftc].net -- http://luke.faraone.cc
PGP fprint: 5189 2A7D 16D0 49BB 046B DC77 9732 5DD8 F9FD D506

signature.asc

Chris D

unread,
Apr 13, 2012, 5:12:02 AM4/13/12
to autoke...@googlegroups.com


On Thursday, 12 April 2012 09:48:21 UTC+10, Luke Faraone wrote:

> shell, external to AutoKey.  I tried using "from autokey import *", but
> I can't get access to "window".  It would be kind of cool if for example
> I could execute a shell script from bash to do something such as launch
> a web browser, log you into Facebook and update your status.  I know
> that AutoKey is just the tool for this, but I'm getting stuck every step
> of the way...

> 2) I'd also like to be able to run one of these python scripts from the

I don't think this is supported.


You can run AutoKey scripts from a shell script using the autokey-run program. It comes with its own man page and is very simple to use. Of course, AutoKey must be running for this to work

Thoric

unread,
Apr 17, 2012, 8:04:02 PM4/17/12
to autoke...@googlegroups.com
Another question.  Does autokey provide any sort of provision to check that a control is ready for input?  If you want to automate a GUI task that requires filling out a textbox, clicking a button, waiting for a task to complete, and then clicking another button on a subsequent screen, is there any way to know when/that the second button on the second screen exists and is ready to be clicked (beyond simply sleeping an adequate amount of time)?

Chris D

unread,
Apr 17, 2012, 9:18:17 PM4/17/12
to autoke...@googlegroups.com
No it doesn't provide any kind of functionality along those lines. You might want to take a look at LDTP, it is specifically designed for the kind of automation you are talking about.
Reply all
Reply to author
Forward
0 new messages