Kreatorul 0 Posted August 13, 2006 Hi...i don't know why this isn't working..i am trying to make a robot for Yahoo Messenger...but it doesen't work and i donno why #include <GUIConstants.au3> GUICreate("Y!M robot", 500,420, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018) GuiCtrlCreateLabel( "First id", 5, 7) $id1= GUICtrlCreateInput ( "", 40, 5, 100, 20) GuiCtrlCreateLabel( "First answer", 160, 32) $answer1=GUICtrlCreateInput ( "", 220, 5, 100, 20) GuiCtrlCreateLabel( "First id", 5, 32) $id2 = GUICtrlCreateInput ( "", 40, 30, 100, 20) GuiCtrlCreateLabel( "First answer", 160, 7) $answer2=GUICtrlCreateInput ( "", 220, 30, 100, 20) $btn = GUICtrlCreateButton ("Let's do it", 40, 75, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn exitloop EndSelect Wend Opt("WinTextMatchMode", 1) Opt("WinTitleMatchMode", 2) IF WinActive( $id1, "") Then Send( $answer1 & "{ENTER}" ) ElseIf WinActive( $id2, "" ) Then Send( $answer2 & "{ENTER}") EndIf It is supposed to be pretty simple...if the window title matches the title written in one of the input boxes then send the first or the second answer depending on the window title... Share this post Link to post Share on other sites
lopolop 0 Posted August 13, 2006 (edited) are you tring to say that $id1 is the Window Name? id so you need to do like Do If WinActive( GuiCtrlRead($id1) ) Then Send( GuiCtrlRead($answer1) & "{ENTER}" ) ElseIf WinActive( GuiCtrlRead($id2) ) Then Send( GuiCtrlRead($answer2) & "{ENTER}") EndIf Until WinActive( GuiCtrlRead($id1) ) or WinActive( GuiCtrlRead($id2) ) also you probably ment 2nd id and 2nd answer at the beggining and idk if you want that loop.. but you need some loop other wise it'll check once and exit Edited August 13, 2006 by lopolop Share this post Link to post Share on other sites
MHz 80 Posted August 13, 2006 (edited) Kreatorul, This is not the Gui forum, so do make good use of it next time. Especially when using search. As well as lopolop mentions, A bug I see you using WinActive() with Send(), but you are not WinActivate()ing the IM window for it to receive the Send(). The Gui would be the active window so you need to use WinActivate() on the IM. Also use WinWaitActive to ensure your Send() is not a misguided event. Edited August 13, 2006 by MHz Share this post Link to post Share on other sites
Kreatorul 0 Posted August 13, 2006 Not working...i am going crazy... YEs at the beggining i ment 2nd id and 2nd answer...that's just a tiny problem...but how can i get this to work? Share this post Link to post Share on other sites