Jump to content

Javascript from web to initiate interaction


Doofus
 Share

Recommended Posts

Sorry if this exists somewhere in the forums, but I couldn't search for 'javascript' ;)

I'm looking to click a button on a web page to copy text, 'alt+tab' (or select the other program by window name), and 'paste' (maybe even clicking at a particular point on the screen prior to the paste). The first step is already taken care of (copying text to the clipboard). The 'alt+tab' and beyond sounds like something that's right up AutoIt's alley, but how to initiate that from a webpage is what I'm stuck on.

I saw something about AutoItX -- but I'm not sure I wanna lock myself into IE. My original thought was to try to have javascript send some magic key combo that a running instance of AutoIt intercepts and does the other two or three steps. If there are other ways to do it, I'm open to suggestions ;)

Thanks!

Link to comment
Share on other sites

I'm working with a group that's creating a simple electronic voting system for our local city council. The clerk's interface, in my mind, will be a web page with the last 'x' votes, each with a 'copy to notes' button. Their note taking software is a proprietary piece of software that includes the video feed from the gov't channel and is automagically uploaded (and subsequently hosted by) the company that makes the software. So, as silly as it is, the notes need to be kept in that software.

Thus, what I'm working on is the ability to 'copy to notes'. Javascript is a client side application. It's javascript on the page that I'm testing with that copies a div to the clipboard. What I'm looking to do next would be to 'alt+tab' (or activate the note taking software's window) and 'paste' (maybe clicking at the bottom of the area that I know to be the note taking area first). Those two tasks (changing windows and pasting) are accomplishable by autoit. It's the initiating of the autoit script that I'm unsure how to accomplish.

Link to comment
Share on other sites

  • 4 weeks later...

Anybody?

The only thing I can think of doing would be to leave a "watching" autoit script running that looks for a window with a specific title. From the website, I'd then open a new window with the specified title, and have copied the data to the clipboard. At that point, the autoit script, having recognized the new window, would 1) close the window, 2) alt+tab (or activate the other program), 3) paste.

Just wondering if there's a cleaner way to do it...

Link to comment
Share on other sites

I take it you're aware that you can download a webpage with InetGet or InetRead. This would be the preferred route. A regex should be able to filter out the required data. You can then poke the data into the client app using Send, or just write it straight to a file. This is a relatively safe route from a security POV, whereas allowing a webpage opened in a browser to manipulate local data could create all manner of exploits.

Incidentally, with most 'security conscious' browsers you can't access page text as a window property, but you can access the URL bar that way. Thus you could read the URL bar location and feed that into InetGet, if necessary.

The other route would be to use the Firefox option to save the webpage complete to a local file, then open that in the browser. You can then use Javascript to manipulate page data and save it to a file, provided you are using a version prior to the latest, OR you make a small change to the browser security settings. The InetGet method would probably be better and safer, though.

Link to comment
Share on other sites

  • 2 weeks later...

Hm. InetGet... Best way I see that working would be through the page launching a separate window who's just an ajax function then parsable by InetGet. I guess that's how that'd work.

I don't see that really being a more viable option than I noted in post #4 of this topic though. And if we're vaguely secure with the web site, unless I can store some credentials in autoit, I'd be unable to pull the data down in that ajax call...

Sounds like my best option is to:

1) launch a small titled window (maybe change the title after page is loaded to make sure it's finished loading before the watching autoit script takes over)

2a) have the small window highlight all text via javascript

-or-

2b) have the watching autoit script press "ctrl+a"

3) have the watching autoit script press "ctrl+c"

4) have the watching autoit script press "ctrl+w"

5a) have the watching autoit script press "alt+tab"

-or-

5b) have the watching autoit script activate the client's note taking software

6) have the watching autoit script press "ctrl+v" (maybe prepended by clicking in a specific location)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...