Jump to content

window automation


Glyco
 Share

Recommended Posts

Hi

i want to wait for a window to get active, start it, activate it, do some clicks & close it.

but the problem is that Window has no title or hidden text.

i searched the forum and did not find anything which can help me out. i also asked my brother who is good in Autoit but he sent me here ;)

Here is the info i collected through AutoIt Window info tool

Title:

Class: #32770

Position: 191, 94

Size: 728, 557

Style: 0x94CF0844

ExStyle: 0x00010100

Handle: 0x049B0242

>>>> Visible Text <<<<

OK

Cancel

List1

Sections

>>>> Hidden Text <<<<

List1

Restart

New

i tried to use it's Class name, but the problem is there are two other programs with same class name.

For example, Internet Download Manager (IDM) uses the same Class name as the window i am working on.

Secondly, i thought of using Handle, i don't know how to use it but i think Handle gets changed every time we restart the computer or run the program on some other computer.

So, how can we do it?

Possible or Impossible?

Link to comment
Share on other sites

i want to wait for a window to get active, start it, activate it, do some clicks & close it.

You want the window to get active and then start it? Sounds like it shoud be the other way around?

Link to comment
Share on other sites

Have you tried

Opt('WinDetectHiddenText', 1)
Here is a quick bit of code that will display all of the CLASS:#32770 windows open
Opt('WinTitleMatchMode', 4)
Opt('WinDetectHiddenText', 1)

Local $WindowArray = WinList('[CLASS:#32770]')
Local $ProcessArray = ProcessList()

For $i = 1 To $WindowArray[0][0]
    For $z = 1 To $ProcessArray[0][0]
        If WinGetProcess($WindowArray[$i][1]) = $ProcessArray[$z][1] Then
            Local $Name = $ProcessArray[$z][0]
            _Splash('Window Handle: ' & $WindowArray[$i][1] & @LF & 'PID: ' & WinGetProcess($WindowArray[$i][1]) & @LF & 'Name: ' & $Name)
            Sleep(2000)
            ExitLoop
        EndIf
    Next
Next

Func _Splash($Text) ;Shows a small borderless splash message.
    SplashTextOn('', $Text, 900, 80, -1, 5, 33, '', 14)
EndFunc   ;==>_Splash

Link to comment
Share on other sites

@ Varian

i checked this post and found 6 process names with same class.

Like:

IDMan.exe

UnlockerAssistant.exe

IeMonitor.exe

PicSet.exe

endamule.exe

DvdSpy.exe

now how do i know that which is needed?

i am confused.

Edited by Glyco
Link to comment
Share on other sites

That smell Bots...

i have not created any game bot or spamming bot in my life.

what i asked is for a Windows program.

here is another window info without title

>>>> Window <<<<

Title:

Class: TForm1

Position: 147, 219

Size: 532, 569

Style: 0x16CA0000

ExStyle: 0x00010110

Handle: 0x00040320

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Name:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle:

>>>> Mouse <<<<

Position: 484, 231

Cursor ID: 2

Color: 0x0055E5

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Show Details

Delete

Stop

>>>> Hidden Text <<<<

Create New

i need some solution. i have been trying to do for 1 week but no success yet.

Link to comment
Share on other sites

Sorry !

But no title, no text, no process : indices are light !

So, how do you recognize the window ?

i think there is still a way to do it. i am just giving an idea of what is in my mind.

Maybe this can work...

WinList() & get a list of all available windows using WinGetState option 1.

Then, exclude all the Window's Handles which does not have Window Titles.

Now, Get the Window size of windows without title using WinGetPos()

& If $size[2] = $Win_Width & $size[3] = $Win_Height Then

that 'll be the exact window which we are looking for...

& then using it's handle we can work on it...

i don't have time, maybe someone else can write a UDF of it.

it 'll be great and helpful for all...

i have one more idea but i am not sure if it 'll work or not, here is it:

While 1
    $size = WinGetPos("[active]")
    If $size[2] = 728 & $size[3] = 557 Then
        ;do some stuff using $size or [active]
    EndIf
WEnd
Link to comment
Share on other sites

@SprinterGuru: I don't think so, but it being based on the screen size doesn't have to mean it's the full screen size. It is also possible that the window is resizable and remembers it's last size, but it's easy to check if the size is constant.

I believe size can be different depending on the OS you are running and what display style you use, but I'm not certain.

HavikTech is probably on the right track here. You could also incorporate window styles into that idea and maibe check for available controls.

If the software is something common, or some freeware, it'd still be nice to know what you're dealing with here and you'd get allot more examples.

Link to comment
Share on other sites

@ Varian

i checked this post and found 6 process names with same class.

Like:

IDMan.exe

UnlockerAssistant.exe

IeMonitor.exe

PicSet.exe

endamule.exe

DvdSpy.exe

now how do i know that which is needed?

i am confused.

  • You said that you are looking to manipulate a window of Class 32770, and the script I provided gave you a list of all of the Windows of that class. Was your process and Window open at that time? If it was, and you know the processes that are NOT the process that you are looking for, you can find your process through exclusion. You know that the process that you want is NOT IDMan.exe, and if it is not UnlockerAssistant.exe or IeMonitor.exe, you can scroll through the list to until you are left with only 1 process left.
  • If you use the Opt('WinDetectHiddenText', 1), you can specify the window with unique text rather than using the process of elimination way above.
    Opt('WinTitleMatchMode', 4)
    [*]Opt('WinDetectHiddenText', 1)
    [*]$hWindow = WinGetHandle('[CLASS:#32770]', 'List1')
  • Can't you just open taskmanager and look at the processes to narrow down your search of the process name? Unless it is being run by svchost, you can guesstimate a small list of processes that it could be.
  • It seems like you have enough markers to identify the window that you are looking for. If more than one CLASS:#32770 window has "List1" in its text, you can further qualify it with scrolling through the array and use more text compares like
    If StringRegExp(WinGetText($WindowArray[$i][1]), ''), '(?i)Restart') Then
    [*] ;This is my window
    [*]EndIf
    I'm just not sure what is confusing you.
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...