r/pythontips • u/DonPatronn • Apr 30 '21
Python3_Specific Python bot for ADB android
Whats up Reddit,
Ive been working on a script to automate certain tasks on various social media/games and retail sites.
Currently I have been working with pyautogui and it works fine but still has issues with finetuning the click mechanics (image recognition/screenshot tool) Even when I add [confidence=0,8/0,9] And proceed to call the locateCenterOnScreen(), the printed results show coordinates way out of my screen proportions.
My question is if this is the right GUI to work with on a script like this? At the moment I am running my script on scrcpy connected to ADB with my android phone. Which works okay. I’m fairly new to the subject so sometimes I don’t know where to begin searching which is why I’m asking it here.
Could anyone help me out sharing some knowledge? What should I use to create bots to automate certain/complicated tasks on a phone. If its convenient I could post parts of my code on here.
Thanks for taking the time to read!
2
u/karankadam May 01 '21
Have a look at Insomniac for Instagram. They use the same technique commands via adb to automate Instagram engagement.
1
u/DonPatronn May 02 '21
Hey just wanted to update the thread. I have been able to solve the wrong coordinates for locateCenterOnScreen(). Macbook users listen up lol.. Ive read somewhere that the macbook pixel density is different because of the high resolution screen.. this makes pyautogui detect an abnormally large screen with the screenshot function.. i havent actually found a solve but more of a workaround.. when you add pyautogui.click(“imagename”.x/2,”imagename”.y/2). This divides the coordinates in 2 so the right location can still be clicked on double resolution. With image recognition working properly I have managed to build a stable script