Jump to content

Recommended Posts

Posted (edited)

If you look with Autoit info tool you can read the Class under the title.

Scite's is SciTEWindow

winRar's is WinRarWindow

How can i take the Class name of a window title or from a process if better in my prog? (Not the WinGetClassList)

Edited by Amen
  • 6 months later...
Posted

If you look with Autoit info tool you can read the Class under the title.

Scite's is SciTEWindow

winRar's is WinRarWindow

How can i take the Class name of a window title or from a process if better in my prog? (Not the WinGetClassList)

I also need this information. It cand be a way to build dinamically controls' classNameNN.

Could someone tell us if this is imposible with autoit (at the moment).?

Thanks a lot.

  • Moderators
Posted (edited)

I could be wrong, but I believe these 2 questions are actually different.

@Amen

Opt('WinTitleMatchMode', 4)
$Title = WinGetTitle('classname=WinRarWindow')
MsgBox(0, 'Title', 'The Title Is: ' & $Title)

@belitre: http://www.autoitscript.com/forum/index.ph...topic=17210&hl=

Edit:

I didn't notice you used the word 'build' belitre, but that thread may still come in handy for future ventures if your going to play with ClassNameNN(s).

Edited by SmOke_N

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 just played a little

#include <GUIConstants.au3>
Run("notepad.exe", "", @SW_MAXIMIZE)
sleep(2000)
$File = FileGetShortName(@ProgramFilesDir & "\Autoit3\Au3info.exe")
$PID = Run($File,"", @SW_MINIMIZE)
ControlSend("Untitled","","Edit1","Getting info" & @CRLF)
MouseClick("left", 100, 100)
Sleep(2000)
$text = ControlGetText ("AutoIt v3 Active Window Info", "Press CTRL-ALT-F to pause the display.", "Edit1" )
$result = StringSplit($text, @CRLF)
MsgBox(64, "Class", $result[9] )
ControlSend("Untitled","","Edit1", $text)
WinClose("AutoIt v3 Active Window Info")

8)

NEWHeader1.png

Posted

i just played a little

#include <GUIConstants.au3>
Run("notepad.exe", "", @SW_MAXIMIZE)
sleep(2000)
$File = FileGetShortName(@ProgramFilesDir & "\Autoit3\Au3info.exe")
$PID = Run($File,"", @SW_MINIMIZE)
ControlSend("Untitled","","Edit1","Getting info" & @CRLF)
MouseClick("left", 100, 100)
Sleep(2000)
$text = ControlGetText ("AutoIt v3 Active Window Info", "Press CTRL-ALT-F to pause the display.", "Edit1" )
$result = StringSplit($text, @CRLF)
MsgBox(64, "Class", $result[9] )
ControlSend("Untitled","","Edit1", $text)
WinClose("AutoIt v3 Active Window Info")

8)

Thanks, Valuater. It can be a solution (and an idea to deal with some problems I have to solve). It's a pity that it can't be made programatically (via getWinClass function or similar). I will suggest it for next autoit versions.

SmOke_N, you're right that thread will be useful for me. At this time I want to access to my controls adding NN to ClassName. NN doesn't change each iteration, but ClassName does. While I'm not able to find a more 'elegant' solution I will adapt Valuater's code.

Posted

I have thought another posibility for my problem, using WinGetClassList.

In my enviroment, the windows change the name in each execution, and the controls contained

in those windows have a fixed name depending on window's ClassName.

An example:

Window class name: WindowsForms10.window.8.app3c

Window Edit control 1: WindowsForms10.EDIT.app3c1

Window Edit control 2: WindowsForms10.EDIT.app3c2

Window Button control 1: WindowsForms10.BUTTON.app3c1

What changes in each iteration is windows class name, affecting all buttons.

And this is what I've written to work with these buttons:

Func tools_ControlName($strCtrlType, $hwndWindow, $mNumber)
    Dim $strCtrlName
    Dim $arrayClassList[99]
    Dim $i
    
    $arrayClassList = StringSplit(WinGetClassList($hwndWindow),@LF)
; We find $strCtrlType in window, getting ClassName
    For $i = 1 To $arrayClassList[0] 
        If (StringInStr($arrayClassList[$i],$strCtrlType) > 0) Then
            $strCtrlName = $arrayClassList[$i] & $mNumber
            ExitLoop(1)
        EndIf
    Next
    
    Return $strCtrlName
  EndFunc

So in a main program I can do something like:

$strCtrlName = tools_ControlName($strCtrlType, $hwndWindow, $mNumber)
[i]; We can switch here for each type of control[/color][/i]
  $hwndControl = ControlGetHandle($hwndVentana, "", $strCtrlName)
[i]; And do what we want with it[/color][/i]

I accept any suggestion or critic. Thanks.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...