Neoborn Posted March 26, 2005 Share Posted March 26, 2005 (edited) Hello,I wonder if anyone can help me with a few basic programming questions / syntax issues? I have a program that I am writing to search hub windows ( DC++ tool)and locate hubs that are not connecting or are sending various error messages. As you can see in the code below I can step (ctrl tab) through the hubs but am unsure of how to proceed. Opt ("WinTitleMatchMode", 4) $title = WinGetTitle("Xreverse connect", "") $title2 = WinGetText("classname=Edit1", "") $sbt = StatusbarGetText($title, "",) MsgBox(0, "Information:", "The title of the window is: " & $title2 & @CRLF & @CRLF & "The status bar text is: " & $sbt) WinActivate($title);;Activate the XRC window Do Send("{CTRLDOWN}{TAB}") Sleep(5000) UntilI am used the MsgBox in the example above to check to make sure it's getting the correct information and it is. The part that I am having an issue with is "Until..." onwards. I would like to say ======================================================Do Send("{CTRLDOWN}{TAB}") Until you encounter txt in a window matching "disconnected', 'connection refused by target machine', 'unknown address' & 'connection timeout'" Then write the value of the window details (name and error) to the list window.After it has collected all windows with errors I can go to the list window and choose from several options ( which will be check boxes of) like 'delete hub' 'uncheck hub from favorites' or 'refresh connection'.======================================================But....first things first....=======================================================I1. Search through windows until a window is found that contains the text "'Disconnected', 'Connection refused by target machine', 'Unknown address' & 'Connection timeout'". Q1. I am unsure as to whether I have to declare each of these error messages to it's own variable or if I can do it like $err = 'Disconnected', 'Connection refused by target machine', 'Unknown address' & 'Connection timeout' and have one variable / function search for all those terms in one go.A1. ???======================================================I2. Once the program finds a window containing any of those keyword / values it will assign that value to a variable and write it to a list box ( in which I can pick or choose which hubs to delete etc)Q2. How do I take these values and assign them to a variable then write them to the list window for selection /deletion etc.?A2. ???=======================================================I would really just like a little help, not not asking for someone to code it all for me but to help me learn, and to accomplish this in the best way as to teach me something so I can do it on my own nextime. I am a noob so please forgive. Yes I love the AutoIT helpfile and use it daily.Thanks for any help in advance Edited March 26, 2005 by Neoborn ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT Link to comment Share on other sites More sharing options...
buzz44 Posted March 27, 2005 Share Posted March 27, 2005 (edited) A1. ???A2. ???#include <GUIConstants.au3> GUICreate ("Win Catcher") $WINLIST = GUICtrlCreateList ( "", 2, 2) GUISetState () $Disconnected = "Disconnected" $CRBTM = "Connection refused by target machine" $UA = "Unknown address" $CT = "Connection timeout" $WGTDisconnected = "" $WGTCRBTM = "" $WGTUA = "" $WGTCT = "" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If WinExists ($Disconnected) Then $WGTDisconnected = WinGetText ($Disconnected) GUICtrlSetData ($WINLIST, $WGTDisconnected & "|" & $WGTCRBTM & "|" & $WGTUA & "|" & $WGTCT) ElseIf WinExists ($CRBTM) Then $WGTCRBTM = WinGetText ($CRBTM) GUICtrlSetData ($WINLIST, $WGTDisconnected & "|" & $WGTCRBTM & "|" & $WGTUA & "|" & $WGTCT) ElseIf WinExists ($UA) Then $WGTUA = WinGetText ($UA) GUICtrlSetData ($WINLIST, $WGTDisconnected & "|" & $WGTCRBTM & "|" & $WGTUA & "|" & $WGTCT) ElseIf WinExists ($CT) Then $WGTCT = WinGetText ($CT) GUICtrlSetData ($WINLIST, $WGTDisconnected & "|" & $WGTCRBTM & "|" & $WGTUA & "|" & $WGTCT) EndIf Wend?edit: just realised you didnt want the Title you wanted the text. srytry this?edit2: removed above codetry this last one then im going to bedexpandcollapse popup#include <GUIConstants.au3> GUICreate ("Win Catcher") $WINLIST = GUICtrlCreateList ( "", 2, 2) GUISetState () $Disconnected = "Disconnected" $CRBTM = "Connection refused by target machine" $UA = "Unknown address" $CT = "Connection timeout" $WGTDisconnected = "" $WGTCRBTM = "" $WGTUA = "" $WGTCT = "" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop _GetWindows() Wend Func _GetWindows() GUICtrlSetData ($WINLIST, "") $list = WinList("","Disconnected") $list2 = WinList("","Connection refused by target machine") $list3 = WinList("","Unknown address") $list4 = WinList("","Connection timeout") For $i = 1 to $list[0][0] If $list[$i][0] <> "" AND IsVisible($list[$i][1]) Then If WinGetText ($list[$i][0],"Disconnected") Then GUICtrlSetData ($WINLIST, $list[$i][0] & "|") EndIf EndIf Next For $x = 1 to $list2[0][0] If $list2[$x][0] <> "" AND IsVisible($list2[$x][1]) Then If WinGetText ($list2[$x][0],"Connection refused by target machine") Then GUICtrlSetData ($WINLIST, $list2[$x][0] & "|") EndIf EndIf Next For $p = 1 to $list3[0][0] If $list3[$p][0] <> "" AND IsVisible($list3[$p][1]) Then If WinGetText ($list3[$p][0],"Unknown address") Then GUICtrlSetData ($WINLIST, $list3[$p][0] & "|") EndIf EndIf Next For $c = 1 to $list4[0][0] If $list4[$c][0] <> "" AND IsVisible($list4[$c][1]) Then If WinGetText ($list4[$c][0],"Unknown address") Then GUICtrlSetData ($WINLIST, $list4[$c][0] & "|") EndIf EndIf Next EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Edited March 27, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Neoborn Posted April 5, 2005 Author Share Posted April 5, 2005 Could someone explain this to me I don't quite understand it? ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Share Posted April 5, 2005 Its what you wanted...? It searches window titles for what you said. qq Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now