HalH Posted June 18, 2010 Share Posted June 18, 2010 Let me first start out saying that this script is not a bot nor will it ever be. This is designed to help some friends at the office speed play chicktionary at ClubBing. It works by keeping the game in one IE frame and AnagarmSolved in a second and does not violate TOS of Bing's. Here is my problem. My script works by loading ClubBing on the top and centering an embedded IE on the game. Player manually starts the game and then types the letters into a small input box and clicks get answers. A second IE frame loads up AnagramSolved with the solutions and (supposedly) refocuses on IE frame 1 with the game. The user then types the answers in and then repeats the cycle. While this is what should happen it isn't. When you start typing you have all of the keys needed (letters, space for clear, backspace if you mistype) but not enter. Hitting enter doesn't seem to do anything. If one clicks down in the second window (AnagramSolved) then clicks back to the game window the enter will work, space and the keys as well but backspace is now registered to cause the "back" command on the AnagramSolved page. Am I completely nuts for trying to do 2 IE embeds or is there something funky here? Below is the script as it currently exists with a workaround in it. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #Include <Misc.au3> _IEErrorHandlerRegister () Dim $gameHandle GUICreate("Anagram Assistant - Cause 2 windows is downright annoying", 650, 745, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 745) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUI_Button_Home = GUICtrlCreateButton("ClubBing.com", 5, 360, 75, 30) $GUI_Load_Game = GUICtrlCreateButton("Load Chicktionary", 85, 360, 100, 30) $GUI_Grab_Letters = GUICtrlCreateButton("Get Letters", 190, 360, 100, 30) $GUI_Letter_Input = GUICtrlCreateInput("", 295, 367, 100, 20) $oIE = _IECreateEmbedded () $oIE2 = _IECreateEmbedded () $GUIActiveX = GUICtrlCreateObj($oIE2, 5, 5, 640, 350) $GUIActiveX2 = GUICtrlCreateObj($oIE, 5, 395, 640, 345) GUISetState() ;Show GUI _IENavigate ($oIE,"http://www.anagramssolved.com/anagram-solutions.html",0) _IENavigate ($oIE2, "http://www.clubbing.com") Global $hHandle = _GetObjectWinHandle($oIE2) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_Button_Home _IENavigate ($oIE2, "http://www.clubbing.com") Case $GUI_Load_Game _IENavigate ($oIE2, "http://www.clubbing.com/Pages/Games/GamePlay.aspx?game=Chicktionary&mode=play") $oIE2.document.focus $oIE2.document.parentwindow.scrollTo(189, 0) $gameHandle = _IEGetObjById($oIE2,"flashGame") Case $GUI_Grab_Letters _IENavigate ($oIE,"http://www.anagramssolved.com/anagram-solutions.html?letters="&GUICtrlRead($GUI_Letter_Input)) $oIE.document.parentwindow.scrollTo(180, 550) $oIE2.document.focus _IEAction($gameHandle,"focus") EndSwitch If _IsPressed("0D") Then ConsoleWrite("sending command:" & ControlClick($hHandle, 0, 0, "primary", 1, 488, 300) & @CRLF) EndIf WEnd GUIDelete() Exit Func _GetObjectWinHandle($oObject) Local $aCall = DllCall("oleacc.dll", "int", "WindowFromAccessibleObject", _ "idispatch", $oObject, _ "hwnd*", 0) If @error Or $aCall[0] Then Return SetError(1, 0, 0) EndIf Return $aCall[2] EndFunc ;==>_GetObjectWinHandle Link to comment Share on other sites More sharing options...
trancexx Posted June 18, 2010 Share Posted June 18, 2010 Read ticket 110 (and don't hold your breath, number is low). Link. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
HalH Posted June 21, 2010 Author Share Posted June 21, 2010 Thanks tranceXX. I implemented the following workaround for the system by catching the {Enter} key in the MsgLoop and turning it into a control click. If _IsPressed("0D") Then ControlClick($hHandle, 0, 0, "primary", 1, 488, 300) EndIf Link to comment Share on other sites More sharing options...
DaleHohm Posted June 23, 2010 Share Posted June 23, 2010 Also search the forum for IECreate2 which uses an alternative to _IECreateEmbedded and does not demonstrate this problem. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now