Monday, November 30, 2015

AutoIt Script for Tap-Titans

If you have been playing Tap Titans on Bluestacks and none of the Android automation tools works for you; perhaps you finally decided to go with Windows automation tools and now you are looking at AutoIt, well, I have written something really simple, and useful, especially at work.

As soon as you run the script, it locates Bluestacks and clicks continuously somewhere in the middle. There are 3 hotkeys configured:

  • PAUSE key - to toggle between running/pause
  • ESC key - to quit from the script
  • SHIFT + PAUSE - to toggle between hiding/showing Bluestacks window (get very familiar with this as this is what you need to do very quickly at work when your manager is passing by)

Script as below:

Global $g_bPaused = False
Global $g_bHide = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+{PAUSE}", "ShowHideDialog") ; Shift-Alt-h

While 1
   Local $hWnd = WinWait("BlueStacks App Player", "", 10)

   while True
   ControlClick($hWnd, "", "", "left", 1, 300, 300)
   WEnd

   Sleep(2000)
WEnd

Func TogglePause()
   $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
   Exit
EndFunc   ;==>Terminate

Func ShowHideDialog()
   $g_bHide = Not $g_bHide

   Local $hWnd = WinWait("BlueStacks App Player", "", 10)

   if $g_bHide == True Then
   WinSetState($hWnd, "", @SW_HIDE)
   Else
   WinSetState($hWnd, "", @SW_SHOW)
   EndIf

EndFunc

Let me know how it works for you ;)

妈咪 - 花生省魔术 - 第六年

你一定不会想到,我们老家地震就算了,那个你也待了好几年的地方,竟然一连几天地震了好几次。 你一定也想不到,那个我们一起去过的国家,有一个末日预言就在今年,甚至有好几个预言家都提出类似的说法。 你又怎么会想到,科学家还发现有高几率外星人在太阳系徘徊,估计有可能年尾会来到地球。 这么...