Kaiva Posted May 27, 2011 Share Posted May 27, 2011 Hey, I'm having a problem with WinActivate. I'm trying to create a script for a game I play, however I've hit a snag. This is my code thus far: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Global $Mana = 197 Global $Dir = "Up" Global $Steps = 0 Global $Battle = 0 $hGUI = GUICreate("AutoIt V3- Example GUI", 400, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") $hButton = GUICtrlCreateButton("Initialize!", 320, 260, 70, 25) GUICtrlSetOnEvent($hButton, "StartProg") ; The button's function GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func StartProg() ;My Function If $Dir == "Up" Then WinActivate("[CLASS:#32770]") WinWaitActive("[CLASS:#32770]","","3") Send("{UP}") Else MsgBox(0, "Test", "Something's wrong") EndIf EndFunc Func ExitGui () Exit EndFunc When I call my StartProg() function, it brings the window to the front, however it does not have focus (it's still semi-transparent). Therefore they keystroke does not get sent to it. How can I sort this? Link to comment Share on other sites More sharing options...
enaiman Posted May 27, 2011 Share Posted May 27, 2011 Not the best start in this community: ignoring forum rules.You should have read this first time you logged in: http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/ SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Kaiva Posted May 27, 2011 Author Share Posted May 27, 2011 I did overlook that, yes; first rule too... Nonetheless, the problem still remains. Link to comment Share on other sites More sharing options...
Recommended Posts