Jump to content

auto answer in yahoo help me


Recommended Posts

Now i'm using yahoo version 9.0.I wrote a script to auto answer when i gone out, but i have a problem with my script.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;Graphic user interface

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICoordMode",2)
        GUICreate("..::*Auto asnwer version 1.0*::.-Written by MR_CHU-",500,350)
            GUISetIcon("Portal to Tristram.ico")
            
$font = "Palatino Linotype Bold"
    GUISetFont(10,30,4,$font)

;the start text 
    GUICtrlCreateLabel("^^Xin moi ban nhap cau tra loi vao ben duoi:^^",130,10)
        GUICtrlCreateLabel(">>>Please add your messages below here:<<<",-1,0)

; input
Opt("GUICoordMode",0)
    $font1 = "MS Sans Serif"
        GUISetFont(8.5,400,$font1)
            $variable = GUICtrlCreateInput("",0,50,270,20)
; create button
                $okbutton = GUICtrlCreateButton("Start-Bat dau",20,30,100)
                Opt("GUICoordMode",2)
                    $cancel = GUICtrlCreateButton("Exit-thoat ra",0,-1)

; setup event
 GUICtrlSetOnEvent($okbutton,"send_message")
        GUICtrlSetOnEvent($cancel,"kill_progress")
              GUISetOnEvent($GUI_EVENT_CLOSE,"closewindow")
                        Opt("GUICoordMode",0)
; dislay GUI
GUISetState()
While 1
    Sleep(10)
Wend

    

;function 
Func closewindow()
    Select
    Case @GUI_CTRLID == $GUI_EVENT_CLOSE 
                Exit
    EndSelect
EndFunc

Func send_message()
    
                Opt("WinTitleMatchMode", 4); set textmode
                WinWaitActive("[CLASS:ATL:00758E58]","")
                Send(GUICtrlRead($variable))
                    Send("{ENTER}")
                        WinSetState("[CLASS:ATL:00758E58]","",@SW_MINIMIZE ); window minimized
            
EndFunc

Func kill_progress()
        ProcessClose("auto messages.exe")
EndFunc

I have a problem with function send_message().If i put it in a loop so i can't exit my script by press exit button.Anyone have any ideas for me?Thx a lot.

Edited by comeonbaby
Link to comment
Share on other sites

This is true, I don't think you can have events fire while the script is paused (waiting on the WinWaitActive() function).

To work around this you'll have to use a different approach. Try somthing like this-

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICoordMode",2)
Opt("WinTitleMatchMode", 4)

$started=False

GUICreate("..::*Auto asnwer version 1.0*::.-Written by MR_CHU-",500,350)
GUISetIcon("Portal to Tristram.ico")         
$font = "Palatino Linotype Bold"
GUISetFont(10,30,4,$font)
GUICtrlCreateLabel("^^Xin moi ban nhap cau tra loi vao ben duoi:^^",130,10)
GUICtrlCreateLabel(">>>Please add your messages below here:<<<",-1,0)
Opt("GUICoordMode",0)
$font1 = "MS Sans Serif"
GUISetFont(8.5,400,$font1)
$variable = GUICtrlCreateInput("",0,50,270,20)
$okbutton = GUICtrlCreateButton("Start-Bat dau",20,30,100)
Opt("GUICoordMode",2)
$cancel = GUICtrlCreateButton("Exit-thoat ra",0,-1)

GUICtrlSetOnEvent($okbutton,"send_message")
GUICtrlSetOnEvent($cancel,"closewindow")
GUISetOnEvent($GUI_EVENT_CLOSE,"closewindow")

GUISetState()

While 1
    if $started and WinActive("[CLASS:ATL:00758E58]","") Then
        Send(GUICtrlRead($variable))
        Send("{ENTER}")
        WinSetState("[CLASS:ATL:00758E58]","",@SW_MINIMIZE)
    Else    
        Sleep(10)
    EndIf
Wend

Func closewindow()
    Exit
EndFunc

Func send_message()
    $started=True    
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...