Jump to content

Recommended Posts

  • Moderators
Posted

How can I use the windows details in AutoIt Windows Info? Specielly "Class"

Carefully?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

How can I use the windows details in AutoIt Windows Info? Specielly "Class"

Look in the help file at the topic "Window Titles and Text (Advanced)".

Example:

; Wait for second instance of Notepad class windows
WinWaitActive("[CLASS:Notepad;INSTANCE:2]", "")

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Look in the help file at the topic "Window Titles and Text (Advanced)".

Example:

; Wait for second instance of Notepad class windows
WinWaitActive("[CLASS:Notepad;INSTANCE:2]", "")

:)

I can't find this.

In my situation my Class is #32770. So how can I use this?

  • Moderators
Posted

I can't find this.

In my situation my Class is #32770. So how can I use this?

Opt('WinTitleMatchMode', 4)

+

WinList("classname=#32770")

+

WinGetProcess(var[n][1])

+

Look for udf's on the forum that can get the exe name and location from the PID (I know Larry made one from dll calls, there are others using COM I believe).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Opt('WinTitleMatchMode', 4)

+

WinList("classname=#32770")

+

WinGetProcess(var[n][1])

+

Look for udf's on the forum that can get the exe name and location from the PID (I know Larry made one from dll calls, there are others using COM I believe).

I am very sorry, but I can't understand it. If I look at WinGetProcess in the help it's not telling me as you describe it, but like this: WinGetProcess ( "title" [, "text"] )

How can you use the way you describe it?

  • Moderators
Posted

I am very sorry, but I can't understand it. If I look at WinGetProcess in the help it's not telling me as you describe it, but like this: WinGetProcess ( "title" [, "text"] )

How can you use the way you describe it?

I showed more than one function... look at winlist() in the help file, look at what [n][1] describes... and you'll understand that when we use WinGetProcess here, we are actually using the handle, not the title.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

I showed more than one function... look at winlist() in the help file, look at what [n][1] describes... and you'll understand that when we use WinGetProcess here, we are actually using the handle, not the title.

but if I do this I get an error:

$PID = WinGetProcess($Array[n][1])

$PID = WinGetProcess($Array[^ERROR

Error: Error parsing function call

Opt('WinTitleMatchMode', 4)

$Array = WinList("classname=#32770")

$PID = WinGetProcess($Array[n][1])

MsgBox(0, "Details", "PID=" $PID)

Posted

but if I do this I get an error:

$PID = WinGetProcess($Array[n][1])

$PID = WinGetProcess($Array[^ERROR

Error: Error parsing function call

Opt('WinTitleMatchMode', 4)

$Array = WinList("classname=#32770")

$PID = WinGetProcess($Array[n][1])

MsgBox(0, "Details", "PID=" $PID)

You can't put a literal 'n' in there. It's an integer value for the array you created with WinList. The number of matching windows is in [0][0]. If there is only one match, or you only care about the first one and with to ignore any more, just put 1 in for 'n'. Otherwise, you want to loop through them like this:

Opt('WinTitleMatchMode', 4)
$Array = WinList("classname=#32770")
If $Array[0][0] > 0 Then
    For $n = 1 To $Array[0][0]
        $PID = WinGetProcess($Array[$n][1])
        ConsoleWrite("Debug: Window title: " & $Array[$n][0] & ";  PID: " & $PID & @LF)
    Next
Else
    ConsoleWrite("Debug: No matching windows found." & @LF)
EndIf

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
  • Moderators
Posted

but if I do this I get an error:

$PID = WinGetProcess($Array[n][1])

$PID = WinGetProcess($Array[^ERROR

Error: Error parsing function call

Opt('WinTitleMatchMode', 4)

$Array = WinList("classname=#32770")

$PID = WinGetProcess($Array[n][1])

MsgBox(0, "Details", "PID=" $PID)

I didn't actually give you code. And I can see you haven't really bothered to read all the functions descriptions and Examples**. I say that, because I don't think you would be saying or doing the above, if you studied each line in the example of WinList().

1. Winlist returns a 2 dimensional array.

[n*]<-represents the number loop you would be if using a "While/For/Do" loop, so you don't literally put that *n in there.

[1]<-is the Handle to that window

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

I didn't actually give you code. And I can see you haven't really bothered to read all the functions descriptions and Examples**. I say that, because I don't think you would be saying or doing the above, if you studied each line in the example of WinList().

1. Winlist returns a 2 dimensional array.

[n*]<-represents the number loop you would be if using a "While/For/Do" loop, so you don't literally put that *n in there.

[1]<-is the Handle to that window

Well, I don't want to go in to a discussion with you. The only thing I would say to what you wrote about the part that I didn't bother to look at the exampel is that you are wrong, cause I did looked at the exampel and what I understand about this is that it runs throug all windows that are current open and give you Title and handle for each window. But I'm not interested in go thoug all windows every time I run my script, but only that windows where the classname is #32770. So what I did was almost what PsaltyDS did (Thank you for the code), but I couldn't get it to work, so I was thinking, maybe I was doing something wrong and wanted you to give me an exampel. Because the exampel PsaltyDS have done still go throug them all and that is not what I want. I want only where Classname is #32770.
Posted

You can't put a literal 'n' in there. It's an integer value for the array you created with WinList. The number of matching windows is in [0][0]. If there is only one match, or you only care about the first one and with to ignore any more, just put 1 in for 'n'. Otherwise, you want to loop through them like this:

Opt('WinTitleMatchMode', 4)
$Array = WinList("classname=#32770")
If $Array[0][0] > 0 Then
    For $n = 1 To $Array[0][0]
        $PID = WinGetProcess($Array[$n][1])
        ConsoleWrite("Debug: Window title: " & $Array[$n][0] & ";  PID: " & $PID & @LF)
    Next
Else
    ConsoleWrite("Debug: No matching windows found." & @LF)
EndIf

:)

Thank you.

1 question.

If I do this $Array = WinList("classname=#32770") will the 1st window be the one i'm asking about? I also noticed that if I close the window and start it again the PID is not the same as before. So how can I use this and be sure that I can activate the window all the time. The reason for using classname/PID is that the Window Title change all the time. In the Window Title there is info that runs all the time, like a newsboard, you know the text is moving from right to left. So I can't use Title.

Posted

Well, I don't want to go in to a discussion with you.

So... you come by that alias kinda' natural, huh? :P

The only thing I would say to what you wrote about the part that I didn't bother to look at the exampel is that you are wrong, cause I did looked at the exampel and what I understand about this is that it runs throug all windows that are current open and give you Title and handle for each window. But I'm not interested in go thoug all windows every time I run my script, but only that windows where the classname is #32770. So what I did was almost what PsaltyDS did (Thank you for the code), but I couldn't get it to work, so I was thinking, maybe I was doing something wrong and wanted you to give me an exampel. Because the exampel PsaltyDS have done still go throug them all and that is not what I want. I want only where Classname is #32770.

PsaltyDS's code does not go through all the windows. It only lists info for the windows of CLASS:#32770. It's a common class, and you probably have more than one. So you may have to be more specific with you WinList input parameter. Read the help file section "Window Titles and Text (Advanced)" and use more specific information than just the class.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

PsaltyDS's code does not go through all the windows. It only lists info for the windows of CLASS:#32770. It's a common class, and you probably have more than one. So you may have to be more specific with you WinList input parameter. Read the help file section "Window Titles and Text (Advanced)" and use more specific information than just the class.

:)

This part:

For $n = 1 To $Array[0][0]

will go throug them all, right?

You say that CLASS:#32770 is a common class and I probably have more than one. If I have AutoIT Window Info active and go throug all windows manually the CLASS is not all time #32770. In fact only one window comes with that.

Posted

This part:

For $n = 1 To $Array[0][0]

will go throug them all, right?

It will go through all of them that are in the array. The point is, the only ones in the array are of that class because of the parameter passed to WinList().

You say that CLASS:#32770 is a common class and I probably have more than one. If I have AutoIT Window Info active and go throug all windows manually the CLASS is not all time #32770. In fact only one window comes with that.

Ahh... but, there are many more windows open at any given time than you can see, or poke at with AU3Info. Try this to see what's up:

#include <array.au3>

$Array = WinList()
_ArrayDisplay($Array, "Debug: All Windows")oÝ÷ Ù.ßÙemæ¦k7b¢é])¶èºZÚ'*)z¶­zïÈì"Ú0²'ò¢æ«zË«{*.j·§¢Ø§µêÞ²×{azuéèë0ØZºÚ"µÍY][
Ú[Ù]Ý]J  ÌÍÐ^VÉÌÍÛVÌWJKH[ÈÈÝY[Y

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

It will go through all of them that are in the array. The point is, the only ones in the array are of that class because of the parameter passed to WinList().

Ahh... but, there are many more windows open at any given time than you can see, or poke at with AU3Info. Try this to see what's up:

:P

Ahh, I didn't know that there are many windows open with that class hidden. So now I understand it. Thank you.

Btw, when I looked in the help for WinList I saw in the related "WinGetHandle" and I think that is the solution that I was looking for.

:)

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
×
×
  • Create New...