Jump to content

GetPosition with ControlListView


Recommended Posts

I have following code, but due to different screen resolutions/sizes on different PC this might cause undesired actions when working with Mouse Positions

The code should select a certain number of files (from 1 to all of the available files with maximum set to 99)

and then copy them (regular procedure in MyProgram is : right mouse click and selecting first option in drop down options)

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 ) ; works perfect and select the files required (file '0' = Foldername)

MouseClick("right", "145", "450", 1) ; works with position

MouseClick("left", "155", "460", 1)

so I tried this code version(s) to replace the above code (without succes)

; ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 ) ; this selects the right files (see above)

; $pos = ControlGetPos( "ActiveProgramWindow" , "", "") ; this return the left top corner of the application, I also tried this with SysListView321

; ControlClick ( "right" , "$pos[0]", "$pos[1]", 1 ) ; try with ControlClick

; MouseClick ( "right" , "$pos[0]", "$pos[1]", 1 ) ; try with simple mouseclick

any ideas ?

I also did some research on how to set the windowsize of the ActiveProgramWindow to predefined settings... without succes to,

so I believe the above code should just have the right syntax to resolve this problem, it only returns or do not return the right mouseposition

I also tried out this, it works but it puts the focus on the same top left corner of the active program window (instead of the SysListView321 window)

; ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 & "," & MouseClick("right", "", "", 1))

Edited by DirkVDB
Link to comment
Share on other sites

I have following code, but due to different screen resolutions/sizes on different PC this might cause undesired actions when working with Mouse Positions

The code should select a certain number of files and then copy them (right mouse click, selecting first option in drop down options)

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 ) ; works perfect and select the files required

MouseClick("right", "145", "450", 1) ; works with position

MouseClick("left", "155", "460", 1)

so I tried this code version to replace the above code (without succes)

; ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 ) ; this selects the right files

; $pos = ControlGetPos( "ActiveProgramWindow" , "", "") ; this return the left top corner of the application, I also tried this with SysListView321

; ControlClick ( "right" , "$pos[0]", "$pos[1]", 1 ) ; try with ControlClick

; MouseClick ( "right" , "$pos[0]", "$pos[1]", 1 ) ; try with simple mouseclick

any ideas ?

Your ControlClick is missing the first 3 parameters! The MouseClick is at the top left corner but you need to click inside the ListView.

Maybe something like this

ControlClick ( "ActiveProgramWindow" , "",  "SysListView321","right" );should click in the middle of the listview.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Your ControlClick is missing the first 3 parameters! The MouseClick is at the top left corner but you need to click inside the ListView.

Maybe something like this

ControlClick ( "ActiveProgramWindow" , "",  "SysListView321","right" );should click in the middle of the listview.
I tried it in different ways :

; MouseMove( "300", "444") as initially, your code moves the focus away from the top left corner position I tried to reposition the focus closer by the listview :-)

; Sleep( 1000 ) and to avoid interaction add some sleep to it :-)

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 )

ControlClick ( "" , "", "SysListView321","right" )

but no way it's keeping doing his thing without listening lol

it's a fact the reaction of the system changes, so I will try this with different syntax, unless somehow there is a build in command somewhere lost... I hope

Link to comment
Share on other sites

why these 2 different syntaxes can't work, they would solve many problems :

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 , MouseClick("right") )

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 )

ControlClick ( "ActiveProgramWindow" , "", "SysListView321", "right" );

4:20 am local time:

finally I returned to the simple mouseclicks version, like this :

ControlListView ( "ActiveProgramWindow", "", "SysListView321", "Select", 1, 99 )

MouseClick("right", "145", "450", 1)

MouseClick("left", "155", "460", 1)

Sleep( 1000 )

; While will go till the last file message pops up to overwrite it

While WinActive ( "Target file already exists." )

WinWaitActive( "Target file already exists." )

Sleep( 1000 )

ControlClick( "Target file already exists.", "", "[iD:5100]" ) ; confirms to overwrite the file

Sleep( 1000 )

WEnd

Might be an issue to investigate for the authors of AutoIT ????

Edited by DirkVDB
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...