Sign in to follow this  
Followers 0
Tankbuster

WinGetClass possible? [solved]

4 posts in this topic

#1 ·  Posted (edited)

As always: I searched the forum, read a lot of posts but somehow it looks I'm stuck....

I will describe my issue, so you may post me a link to old stuff/posts or help me out right here. :graduated:

I wrote for my self pleasure a Window Arranger (a app that stores the location and size of certain windows and on try command it moves the windows to their stored position). Up to last version I stored the Name=Window Title and position in a INI. And now I thought it would be nice to add new Windows to the INI.

(this is working no problem).

So I extended the script with a AddFunction.

This is also working, BUT :( currently I head for the TITLE of the active window. (WinGetPos("[TITLE:" & $titleAdd & "]"))

But testing the issue, I thought of:

What if I want to store the position of eg. firefox but the title is different (of course), than my TitelMatch won't work. As a additional aproach I want to head for the class of a window (so either Class or Title matches)

In my scenario I want now either the TITLE OR the CLASS stored. But I cant' figure out how to get the CLASS of a active window.

help file: WinGetTitle("[active]") returns the active window's title

so i there a function like:

WinGetClass("[active]") returns the active window's class?

I added the code of my function, just to show the search lines. But I think my question is clear (at least for myself....muhahaha :D ).

I fear that the solution is just too obvious. Do I missed something in the helpfile?

Autoit Used: 3.3.6.1

Func AddWindow()
    Local $titleAdd = WinGetTitle("[active]")
    Local $result = MsgBox(32 + 4, "EMU Arranger:", "Add this title?" & @CRLF & $titleAdd)
    If $result = 6 Then
        Local $winsave_para = WinGetPos("[TITLE:" & $titleAdd & "]")
        IniWrite($IniFileName, $titleAdd, "WINDOW", "" & $winsave_para[0] & "," & $winsave_para[1] & "," & $winsave_para[2] & "," & $winsave_para[3] & "")
    EndIf
    HotKeySet("^!a")
    ReadWindowsPos()
EndFunc   ;==>AddWindow
Edited by Tankbuster

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I dont think there is a native function for that, and I havent seen a udf either.

Have you thought of using the wintitlematchmode option?

EDIT:

WinGetClassList might help.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

:graduated:

Thank you, of course it was to obvious.

And to add to my own shame, if I had used the help file search function" window class name" (not the forum search) I would have found it with the first search......slap me for that, sorry to bother you with this post.

But thank you (all) very much !

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  
Followers 0