Jump to content

Need help with WinActivate


Recommended Posts

Here's the script:

#include <GuiConstants.au3>

GuiCreate("MapleStory", 210, 71,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Win Activate + Send ( {Enter})", 10, 10, 190, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        WinActivate ( "MapleStory, "")
        Send ( "{Enter}")
    EndSelect
WEnd
Exit

It's only activating MapleStory, but not sending "{Enter}"...

Edited by Info
Link to comment
Share on other sites

WinActivate() just sends a message to Windows and returns. It doesn't wait for the window to actually become active, before going on to the next line in the script. So you might want a WinWaitActive() after the WinActivate() to keep the script from doing Send() before the window is really ready.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You mean like this:

#include <GuiConstants.au3>

GuiCreate("MapleStory", 210, 71,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Win Activate + Send ( {Enter})", 10, 10, 190, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        WinActivate ( "MapleStory")
        WinWaitActive ( "MapleStory")
        Send ( "{Enter}")
    EndSelect
WEnd
Exit

Like this?

Edited by Info
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...