Jump to content

Window size, window corner positions?


Recommended Posts

Hi,

Newb here, I've recently written a script with autoit that is 98% automated (just needs a little bit more). The issue I have is as follows:

The program that the script sends to, isn't very interactive, I need to be able to grab a ticket number from the application. The plan was to select all visible data (ala Ctrl + A) and copy it into a variable and then find the correct string, but this app doesn't even allow you to use the select all function: it doesn't have a select all function. Next idea was to record mouse positions and select the data field with that, however, I have a feeling users are going to move the application all over the place. (I am already aware of blockinput to stop the keyboard/mouse input, however, if the users move the window in between running the script, this could still be an issue)

The last question becomes, is there a way to have definite positions?

Say for example i move windows explorer a little bit, can i record the position of the top right or top left hand corner etc. OR can i for example use a keyboard shortcut to get to the file menu and record that position.

Thanks in advance :)

P.S Redirection to forums where this has been answered would also be appreciated.

Edited by berserker
Link to comment
Share on other sites

Say for example i move windows explorer a little bit, can i record the position of the top right or top left hand corner etc. OR can i for example use a keyboard shortcut to get to the file menu and record that position.

WinGetPos() will give you the position and size of a window.

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Welcome to the forum.

There are so many ways to do this within AutoIt, I'm having trouble figuring out where to start.

One simple way is to use WinMove to put the screen in the upper left 0, 0 (X, Y) coordinate position. WinMove might also be able to resize the window so that everything is in a known place.

Then there is the different mouse coordinate modes - go to the help file, select the tab labeled "Index", type Opt and press enter. Read up on MouseCoordMode. Also, when using the AU3 window info tool to get the mouse coordinates, you might need to change the mode that it is reporting the coordinates: Options > Coord Mode > Screen or Window or Client.

Better yet would be AutoIt's ControlGetText function - using this function may let you get the info of interest no matter where the window is. You will want to read the help file page about controls - one thing that it states:

Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!

http://www.autoitscript.com/autoit3/docs/intro/controls.htm

Hope this helps,

-MSP-

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...