Author Topic: Visual Pinball  (Read 4921 times)

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 801
    • Email
Visual Pinball
« on: August 25, 2013, 09:35:49 AM »
Source code

Code: AutoIt
  1. ;Parsing
  2. Local $count = StringInStr($CmdLineRaw, ".exe", 0, 1, 1)
  3. local $app = StringLeft ( $CmdLineRaw, $count + 4 )
  4. local $command = StringTrimLeft( $CmdLineRaw, $count + 4 )
  5. if not $command then exit 0
  6.  
  7. HotKeySet("{ESC}", "Terminate")
  8.  
  9. $PID = Run( '"' & $app & '" ' & $command )
  10.  
  11. while _WinWaitActivePID($PID)
  12.    sleep(500)
  13.  
  14. While WinExists("Visual Pinball Player")
  15.      Sleep(500)
  16.  
  17. Exit 0
  18.  
  19. ;Functions
  20. Func Terminate()
  21.         WinClose ( "Visual Pinball Player")
  22.         ControlClick("[CLASS:#32770]", "Paused", 293)
  23.         WinClose ("Visual Pinball")
  24.         WinActivate ("mGalaxy")
  25.     Exit 0
  26.  
  27.  Func _WinWaitActivePID($iPid)
  28.     While 1
  29.         Local $list = WinList()
  30.         For $i = 1 To $list[0][0]
  31.             If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then
  32.                 If WinGetProcess($list[$i][1]) = $iPid AND WinActive($list[$i][1]) Then Return $list[$i][0]
  33.             EndIf
  34.         Next
  35.     WEnd
  36.  
  37. Func IsVisible($handle)
  38.     If BitAND(WinGetState($handle), 2) Then
  39.         Return 1
  40.     Else
  41.         Return 0
  42.     EndIf

Executable

http://www.mgalaxy.com/forum/index.php?action=downloads;sa=view;down=43
« Last Edit: August 25, 2013, 03:50:41 PM by mgalaxy »