Jump to content
Sign in to follow this  
rosswg

Pgadmin the postgres tool

Recommended Posts

rosswg

Below is how far I have got in trying to automate pgadmin.

the controlclick highlights the database that I am trying to connect to.

If I use a mouse I double click, but I cannot seem to figure out how to do it using Autoit

Would you (the reader) kindly help me.

Run("c:\Program Files\pgadmin III\1.8\pgadmin3.exe")

WinWaitActive("pgAdmin III")

ControlClick("pgAdmin III","","[class:SysTreeView32]" ,"left", 2, 45,25 )

sleep(200)

send("!t")

sleep(800)

WinMenuSelectItem ( "", "", "&Connect" )

SEND("!c")

;------------------this that have been tried --

;WinMenuSelectItem ( "pgAdmin III", "", "Tools" , "Connect" )

;ControlFocus("pgAdmin III","","[class:SysTreeView32]")

;SLEEP(400)

;Send("!{ENTER}")

;mouseclick("left",80,158)

Share this post


Link to post
Share on other sites
rosswg

Yes I have made some progress on the problem.

One has to get the position of the window - this gives a 4 element array - as x,y, width and height.

The by working out where I need to mouseclick, in the window, these x and y values are added to the contol x,y values.

These clicks now work.

At this stage this is not a robust (fail safe) way of achieving getting it to work, but it does work.

It is not fail safe because if the contents of the window change the position of the clicks must also be changed.

As I am working on a 'tree'. It would be better to count the elements in the tree, then by knowing the height of the line,

one could then know better where to click.

Getting there.

Share this post


Link to post
Share on other sites
rosswg

Yes I have made some progress on the problem.

One has to get the position of the window - this gives a 4 element array - as x,y, width and height.

The by working out where I need to mouseclick, in the window, these x and y values are added to the contol x,y values.

These clicks now work.

At this stage this is not a robust (fail safe) way of achieving getting it to work, but it does work.

It is not fail safe because if the contents of the window change the position of the clicks must also be changed.

As I am working on a 'tree'. It would be better to count the elements in the tree, then by knowing the height of the line,

one could then know better where to click.

Getting there.

The problem with mouse clicking is that unless you have a long sleep time- it is inconsistent.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.