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 ;)

过了这么久

还活着。 世界变了很多。 我们走在后面了,思想上和体力上,都要给年轻人让路了。 酒喝不起来,饭也不怎么吃得下了。路也不能走太远,视觉也就眼前那一点距离。 回想起年轻时的岁月,那时的我们意气风发,总觉得世界在掌心里转动。夏日的午后,我们在酒吧畅谈理想,谈论着要如何攀爬如何荣耀。那时...