Jump to content

Help please...


Recommended Posts

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 :):lmao:

#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... :whistle::)

Link to comment
Share on other sites

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 by lopolop
Link to comment
Share on other sites

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