WnG88 Posted June 28, 2016 Share Posted June 28, 2016 Hi, I'm trying to use AutoIT with MEmu emulator just to do a basic task of launching a program on the desktop. This wasn't an issue when using VirtualBox. Anyone have experience using AutoIT with MEmu? I'd like to move over to using it instead of VirtualBox. MEmu just runs Android apps better. Thanks. I am using the following basic code: Func Test() $Success= ControlClick("[CLASS:Qt5QWindowIcon]", "", "[CLASSNN:SQt5QWindowIcon6]", "", "", "290", "200") Switch $Success Case 0 ConsoleWrite ("ControlClick Failed" & @CRLF) Case 1 ConsoleWrite ("ControlClick Success" & @CRLF) EndSwitch EndFunc I think the CLASSNN isn't right even though AU3Info is saying this is the control. I've also tried using another bit of code from the forums that catches the CLASSNN based on Mouse Position - again it works with VirtualBox but not MEmu. expandcollapse popup; Function Name: _CtrlGetByPos() ; Description: Get the Control ID or the ClassNameNN by the X and Y client coordinates ; Syntax: _CtrlGetByPos("Window Title", [Control Text], [X Client Coord], [Y Client Coord], [Return Type]) ; ; Parameter(s): $hWin = Window Name or Handle ; $sText = Text of the Control ; $iXPos = X Client Coord ; $iYPos = Y Client Coord ; $iReturnType = Return type (default = 0 (ClassNameNN)) ; 0 = ClassNameNN ; 1 = Control ID ; 2 = Control Handle ; 3 = All 3 ClassNameNN, Control ID, Control Handle ; ; ; Requirement(s): External: = None. ; Internal: = AutoIt Beta 3.1.130 (or which ever release SetError(0,0,0) was introduced) ; ; Return Value(s): On Success: = Returns Array List ; On Failure: = @error 1 (Control was found but there was an error with the DLLCall) ; On Failure: = @error 2 (No classes were found) ; ; Author(s): SmOke_N ; ; Note(s): Similar to LxP's here (This was made before I remembered he had done something similar) ; <a href='http://www.autoitscript.com/forum/index.php?showtopic=14323&hl=' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=14323&hl=</a> ; ; ; Example(s): ; Opt('WinTitleMatchMode', 4) ; _CtrlGetByPos('classname=SciTEWindow', '', 829, 504, 2) ; ;Global $Control_To_Interact_With_Is = _CtrlGetByPos($window[1], '', 840, 50, 3) ;If IsArray($Control_To_Interact_With_Is) Then ; For $i = 1 To UBound($Control_To_Interact_With_Is) - 1 ; MsgBox(0, '', $Control_To_Interact_With_Is[$i]) ; Next ;EndIf Func _CtrlGetByPos($hWin, $sText = '', $iXPos = 0, $iYPos = 0, $iReturnType = 0) If IsString($hWin) Then $hWin = WinGetHandle($hWin) Local $sClassList = WinGetClassList($hWin), $hCtrlWnd Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn = '' For $iCount = UBound($sSplitClass) - 1 To 1 Step - 1 Local $nCount = 0 While 1 $nCount += 1 Local $aCPos = ControlGetPos($hWin, $sText, $sSplitClass[$iCount] & $nCount) If @error Then ExitLoop If $iXPos >= $aCPos[0] And $iXPos <= ($aCPos[0] + $aCPos[2]) _ And $iYPos >= $aCPos[1] And $iYPos <= ($aCPos[1] + $aCPos[3]) Then If $sSplitClass[$iCount] <> '' And Not $iReturnType Then Local $aClassNN[2] = [2, $sSplitClass[$iCount] & $nCount] Return $aClassNN EndIf If $sSplitClass[$iCount] <> '' And $iReturnType = 3 Then $hCtrlWnd = ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ControlFocus($hWin, $sText, $hCtrlWnd) $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd) If @error = 0 And $aReturn[0] <> '' Then Local $aClassNN[4] = [4, $aReturn[0], $sSplitClass[$iCount] & $nCount, $hCtrlWnd] Return $aClassNN EndIf Local $aClassNN[2] = [2, $sSplitClass[$iCount] & $nCount] Return $aClassNN ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 2 Then Return ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 1 Then $hCtrlWnd = ControlGetHandle($hWin, $sText, $sSplitClass[$iCount] & $nCount) ControlFocus($hWin, $sText, $hCtrlWnd) $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd) If @error = 0 And $aReturn[0] <> '' Then Local $aClassNN[2] = [2, $aReturn[0]] Return $aClassNN EndIf EndIf Return SetError(1, 0, 0) EndIf WEnd Next Return SetError(2, 0, 0) EndFunc Thanks for any help. Link to comment Share on other sites More sharing options...
TheDcoder Posted June 28, 2016 Share Posted June 28, 2016 You are threading on thin ice, MEmu is can be used to play android games. If you are looking to automate a game, you won't get any help. Game Automation is forbidden here! So I recommend you focus on automating non-game apps in MEmu . EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
WnG88 Posted June 28, 2016 Author Share Posted June 28, 2016 I know and do agree, but not looking for anything game related. I've got a virtual android session running in windows and would like to launch a program in the android session. If there is no help that is fine. I can stick to Virtual Box but it is a resource hog. Link to comment Share on other sites More sharing options...
TheDcoder Posted June 28, 2016 Share Posted June 28, 2016 Just now, WnG88 said: If there is no help that is fine. As you are not automating games, I can assure you that someone will indeed help you . EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 28, 2016 Moderators Share Posted June 28, 2016 20 minutes ago, TheDcoder said: As you are not automating games, I can assure you that someone will indeed help you . Not for you to decide, in this case. @WnG88 as the official subtitle of MEmu is "Play Android games on PC with Superb Experience", please let me know what non-game activity you're trying to accomplish with this emulator. I have perused their site, and the associated forum, and find nothing that is not related to playing android games. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
WnG88 Posted June 28, 2016 Author Share Posted June 28, 2016 I am testing in windows a Kodi plugin for an android tv box and launching the app multiple instances. Anyways, figured out how to do it. Link to comment Share on other sites More sharing options...
ccanno62 Posted December 13, 2017 Share Posted December 13, 2017 WnG88, can you tell me how to do it? I am having that problem. Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted December 13, 2017 Share Posted December 13, 2017 (edited) I used Nox for a while. I found automation was much cleaner and better using ADB (Android Debug Bridge) than trying to automate the Emuator itself, it could launch applications even if they were not showing on screen. My automation was to auto launch a program, and detect if it crashed and re-launch it. Memu should support the same kind of setup. BTW: YOu may want to start your own tread rather than posting on one a year old, there is not a high chance the same people are watching the thread and ready to answer. Edited December 13, 2017 by ViciousXUSMC ccanno62 and hoangvu0905 2 Link to comment Share on other sites More sharing options...
Recommended Posts