Jump to content

ControlClick issues in Windows 7


mud409
 Share

Recommended Posts

I'm trying to use a script of mine on Windows 7, but it hangs up at the controlclick code below (works absolutely fine in xp). As well, that window info was taken from Win7, not XP (not sure if it matters). *Note, the same exact code works (in win7) with an older version of the application I'm trying to automate.

Run(@WorkingDir & "\" & "KDev.exe")
$wait = WinWait("K Dev", "",  10)
If $wait = 0 Then
MsgBox(0, "Error", "K Dev has not loaded. Now Restarting.", "")
Terminate()
Else
If Not WinActive("K Dev", "") Then WinActivate("K Dev", "")
WinWaitActive("K Dev", "")
EndIf

Opt("WinTitleMatchMode", 2)
ControlFocus ("K Dev", "", "SysListView321")
ControlClick("K Dev", "", "SysListView321", "right", 1)

>>>> Window <<<<
Title:  K Dev
Class:  MainClass
Position:   -4, -4
Size:   1688, 1030
Style:  0x95CF0054
ExStyle:    0x00010110
Handle: 0x015201B4

>>>> Control <<<<
Class:  SysListView32
Instance:   1
ClassnameNN:    SysListView321
Name:   
Advanced (Class):   [CLASS:SysListView32; INSTANCE:1]
ID: 1000
Text:   List1
Position:   162, 30
Size:   680, 932
ControlClick Coords:    566, 294
Style:  0x5011050D
ExStyle:    0x00000204
Handle: 0x025C0498

>>>> Mouse <<<<
Position:   728, 362
Cursor ID:  2
Color:  0xFFFFFF

>>>> StatusBar <<<<
1:  Working
2:  
3:  
4:  

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Tree1
List1
Edited by mud409
Link to comment
Share on other sites

Try this version and report the results:

Run(@WorkingDir & "\" & "KDev.exe")

Global Const $window_title = "K Dev"

$wait = WinWait($window_title, "", 10)

If $wait = 0 Then
    MsgBox(0, "Error", "K Dev has not loaded. Now Restarting.")
    Terminate()
Else
    If Not WinActive($window_title) Then
        WinActivate($window_title)
    EndIf

    WinWaitActive($window_title)
EndIf

Opt("WinTitleMatchMode", 2)

ConsoleWrite("ControlFocus: " & ControlFocus($window_title, "", "SysListView321") & @LF)

ConsoleWrite("ControlClick: " & ControlClick($window_title, "", "SysListView321", "right") & @LF)

It's essentially the same as yours but with error checking.

Link to comment
Share on other sites

That means both functions reported that they were successful, right?

That WinWaitAcitve seems unneccesary.

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