Jump to content

HowTo Get attributes of spawned window?


Guest salski
 Share

Recommended Posts

Guest salski

Hi,

Can anyone give me a way of doing the following please?

What I want to be able to do:

From the Internet explorer window which I have open on my PC, I would like to be able to read the attributes (etc) from the window that pops up after I refesh the page when I am offline.

Explanation:

When I am offline I open the internet explorer and it opens without any problems (defaulting to the cached home page). I then press the refresh button and the window from internet explorer pops up asking me if I'd like to go online or stay offline. This window is what interests me - how do I get this window's title, text, handle and class with my autoit script? It`s really easy to get this info for the internet explorer main window but how do I get it for this pop-up window?

Please help!!!!

java script:emoticon(':D')

java script:emoticon(':huh2:')

Thanks alot,

Salski

Link to comment
Share on other sites

Guest salski

Thanks for replying that unfortunately wasn't much help.

I have found the solution and am proud to pronounce myself an advanced newbee.

Here it is (pretty sexy stuff):

Func _MyState()

Dim $myButtonNames[20]

$myCNT=0

$myClean=""

$x1 = StatusbarGetText($myArray_T_H_C[0],"",1)

$x2 = StatusbarGetText($myArray_T_H_C[0],"",2)

$x3 = StatusbarGetText($myArray_T_H_C[0],"",3)

$x4 = StatusbarGetText($myArray_T_H_C[0],"",4)

$x5 = StatusbarGetText($myArray_T_H_C[0],"",5)

$myArray_LoadVar[1] = $x1 & "," & $x2 & "," & $x3 & "," & $x4 & "," & $x5

_FileWriteLog( $TraceFilePath, "StatusBarText: " & $myArray_LoadVar[1] )

$myText = WinGetText("")

_FileWriteLog( $TraceFilePath, "WinText: " & $myText )

$mymatch = StringInStr ( $myText, "&")

If $mymatch Then

_FileWriteLog( $TraceFilePath, $myText )

EndIf

$state = WinGetState("classname=" & $myArray_T_H_C[2], "")

If BitAnd($state, 32) Then

_FileWriteLog( $TraceFilePath, "Window is maximised" )

ElseIf BitAnd($state, 16) Then

_FileWriteLog( $TraceFilePath, "Window is active" )

ElseIf BitAnd($state, 8) Then

_FileWriteLog( $TraceFilePath, "Window is active" )

ElseIf BitAnd($state, 4) Then

_FileWriteLog( $TraceFilePath, "Window is enabled" )

ElseIf BitAnd($state, 2) Then

_FileWriteLog( $TraceFilePath, "Window is visible" )

ElseIf BitAnd($state, 1) Then

_FileWriteLog( $TraceFilePath, "Window is exists" )

Else

_FileWriteLog( $TraceFilePath, "Window is in other state" )

EndIf

$myText = ControlGetText ( "", "", "")

_FileWriteLog( $TraceFilePath, "ControlGetText: '" & $myText & "'" & Chr(10) & "Title:" & $myArray_T_H_C[0] & Chr(10) & "Handle:" & $myArray_T_H_C[1] & Chr(10) & "Classname:" & $myArray_T_H_C[2])

$myText = WinGetClassList("", "")

;_FileWriteLog( $TraceFilePath, Chr(10) & "WinGetClassList: '" & $myText)

$size = WinGetPos("")

_FileWriteLog( $TraceFilePath, "Active window stats (x,y,width,height):" & $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])

$Offline[0]="Offline"

Dim $Certificates[1]

Dim $myCertChoice

$myCertChoice=""

$Certificates[0]="Sicherheitshinweis"

$Offline[1]="Die Webseite ist im Offlinemodus nicht verfügbar"

$myOfflineChoice=""

If WinWaitActive($Offline[0],"",1)=1 Then

$myGetTextRaw=WinGetText("","")

$myGetClassListText = WinGetClassList("", "")

$myOfflineChoice=$Offline[0]

ElseIf WinWaitActive($Offline[1],"",1)=1 Then

$myGetTextRaw=WinGetText("","")

$myGetClassListText = WinGetClassList("", "")

$myOfflineChoice=$Offline[1]

ElseIf WinWaitActive($Certificates[0],"",1)=1 Then

$myGetTextRaw=WinGetText("","")

$myGetClassListText = WinGetClassList("", "")

$myCertChoice=$Certificates[0]

EndIf

If StringLen($myOfflineChoice) > 0 Then

_FileCreate( $TraceFilePath ) ;

$myTitle1 = WinGetTitle("")

$myHandle = WinGetHandle($myTitle1)

$myTitle2 = WinGetTitle("handle=" & $myHandle)

Send("{ESC}")

If WinWaitActive($Offline[0],"",1)=1 Then

$myClean="Unfinished"

msgbox(0,"unfinished","")

ElseIf WinWaitActive($Offline[1],"",1)=1 Then

$myClean="Unfinished"

msgbox(0,"unfinished","")

Else

$myClean="Clean"

EndIf

ElseIf StringLen($myCertChoice) > 0 Then

_FileCreate( $TraceFilePath ) ;

$myTitle1 = WinGetTitle("")

$myHandle = WinGetHandle($myTitle1)

$myTitle2 = WinGetTitle("handle=" & $myHandle)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; This bit catches the names of the buttons..

$myPos1=StringInStr($myGetTextRaw,"&")

If $myPos1 > 0 Then

$myButtonNames = StringSplit($myGetTextRaw, Chr(10))

_FileWriteLog( $TraceFilePath, "Total Caught:" & $myButtonNames[0] )

Do

$myCNT=$myCNT+1

$myPos=StringInStr($myButtonNames[$myCNT],"&")

If $myPos > 0 Then

_FileWriteLog( $TraceFilePath, "Caught:" & $myButtonNames[$myCNT] )

$myGood=$myGood+1

EndIf

Until $myCNT=$myButtonNames[0]

EndIf

;_FileWriteLog( $TraceFilePath, "Position of &:" & $myPos1 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Send("j")

Else

$myClean="Clean"

EndIf

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; This bit catches the names of the buttons..

; $myPos1=StringInStr($myGetTextRaw,"&")

; If $myPos1 > 0 Then

; $myButtonNames = StringSplit($myGetTextRaw, Chr(10))

; _FileWriteLog( $TraceFilePath, "Total Caught:" & $myButtonNames[0] )

; Do

; $myCNT=$myCNT+1

; $myPos=StringInStr($myButtonNames[$myCNT],"&")

;

; If $myPos > 0 Then

; _FileWriteLog( $TraceFilePath, "Caught:" & $myButtonNames[$myCNT] )

; $myGood=$myGood+1

; EndIf

; Until $myCNT=$myButtonNames[0]

; EndIf

; ;_FileWriteLog( $TraceFilePath, "Position of &:" & $myPos1 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

EndFunc

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...