Jump to content

Creating a macro/writing a script


Space Voyager

Recommended Posts

For quite some time I've had an incredibly tedious task at work; input of data into an extremely cretenoid browse-based application. A coworker created a simple script that helps a whole lot, yet it could be vastly improved if there was a way for the script to recognize (determine) buttons in the browser. I've been reading into AutoHotKey tutorial (coworker created his script in AHK) to see if this is possible but I can't find the info.

 

The application used to enter the data uses input boxes and buttons, so the coworker wrote the script based on mouse coordinates and clicks.

 

Naturally this means that you need to use the same browser, the same window layout and the same screen resolution. Also the application changes the positions of the buttons based on the data alredy entered (the list gets longer, the buttons at the bottom are pushed lower and lower) so the script also uses different hotkeys for different quantities of entered data, which is very awkward and has limits that could all be overcome if there was a way to somehow make the script use a button in the browser window instead of its location.

 

Anyway, the work will go on for like two more months (if everything goes well, which is not the rule around here) and a better script would really help the unlucky few of us burdened with this mindless task.

 

If anyone is familiar in scripting, please https://i22.photobucket.com/albums/b348/SpaceVoyager/Smiley/help.gif.

Link to comment
Share on other sites

I wrote an AutoHotKey tutorial once, after making it play UFO:EU for me. Great program. laugh.png

 

That said, my experience with it probably amounts to less then that of your friend's. Though I suspect that it should be possible to do what you want by firing keyboard input into the browser rather then mouse clicks - eg, hit "tab" five times to jump to button X. This should overcome any problems related to the layout of the page (unless any extra elements are added as data goes in, in which case there'd be no solution but to have the script automatically figure out how many and under what circumstances).

 

If direct access to the database the information is going into can be obtained, then it may be easier to write a program that can automatically pull info from the source and dump it directly into the target format, ignoring the web interface completely. Though I suspect you don't have that sort of access, and for it to be feasible, the formats involved would need to be fairly simple.

Link to comment
Share on other sites

I have no prior experience with AHK so I'll just go through some of the most obvious possibilities you might want to look into:

 

- sometimes buttons have indirect shortcut access keys by means of the associated label

 

- if one of the buttons you want to click is the Default button of the form (such as OK or Submit) you can simply send Enter (scripted Enter key hit) to perform the action

 

- having briefly perused AHK's command list I think your problem could perhaps be solved via ControlFocus. My reasoning being that if you can set the focus to a specific control (in this case a button) then all you'd need to do next, to 'click it', is send an Enter. You'll need information about the active window and the specific control.

 

::

 

Just my .02

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
×
  • Create New...