Finished with working version.
??? designates information I don't want public. Need to change it to suit yourself before it will work.
Warning: Spoiler!
#include <AutoItConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#Include <Date.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
Global $vmRunstart = '\VMware\VMware Workstation\vmrun.exe start "'
Global $vmRunstop = '\VMware\VMware Workstation\vmrun.exe stop "'
Global $vmMain = "?:\???\???\???.vmx"
Global $vmTeam1 = "?:\???\???\???1.vmx"
Global $vmTeam2 = "?:\???\???\???2.vmx"
Global $vmTeam3 = "?:\???\???\???3.vmx"
Global $vmTeam4 = "?:\???\???\???4.vmx"
Global $vmTeam5 = "?:\???\???\???5.vmx"
Global $LoopTimer, $Resttimer, $Hours = 0, $Minutes = 0, $Seconds = 0
Global $g_bPaused = False
Global $sLogPath = "???:\???\"
Global $sDscanpath = "???:\???\???\SharedDscan.ini" ; path to SharedDScan file
HotKeySet("!{ESC}", "_Terminate") ;Alt Escape
HotKeySet("{PAUSE}", "TogglePause")
$number= InputBox("Runs", "How many runs do you want to do?", "???", "", default, default, 0, 0,10) ; Set to how many runs to make
If @error = 2 Then
$number=??? ;set a default because it times out after 10 seconds
EndIf
For $x = 1 to $number
$LoopTimer = Random(???,???) ; Set to runtime in miliseconds usually 2-4 hrs
$RestTimer = Random(???,???) ; Set breaktime in miliseconds usually 1-3hrs
Sleep(1000)
_Shutdown() ; stop all virtual machines
_Begin() ;start all virtual machines
Sleep(1000)
_Countdown($LoopTimer) ; run time of virtual machines
Sleep(1000)
_Shutdown() ; stop all virtual machines
Sleep(1000)
_Breaktime($RestTimer) ; take a break for a couple hours
_Writelog("Break time over")
Next
Func _Begin()
TrayTip ( "Starting Virtual Machines:", "", 10)
_Writelog("Starting bots:")
_RunVM($vmRunstart,$vmMain)
_RunVM($vmRunstart,$vmTeam1)
_RunVM($vmRunstart,$vmTeam2)
_RunVM($vmRunstart,$vmTeam3)
_RunVM($vmRunstart,$vmTeam4)
_RunVM($vmRunstart,$vmTeam5)
EndFunc
func _Writelog($message)
Local $tCur
$tCur = _Date_Time_GetSystemTime()
_FileWriteLog ( $sLogPath & "\Trackinglog.txt", $message)
EndFunc
Func _Shutdown()
TrayTip ( "Stopping Virtual Machines:", "", 10)
_Writelog("Stopping bots:")
_SafeLogOff("True")
Sleep(90000) ; it doesnt take this long for them to dock or pos up. usually done in 15 seconds or less.
_RunVM($vmRunstop,$vmMain)
_RunVM($vmRunstop,$vmTeam1)
_RunVM($vmRunstop,$vmTeam2)
_RunVM($vmRunstop,$vmTeam3)
_RunVM($vmRunstop,$vmTeam4)
_RunVM($vmRunstop,$vmTeam5)
_SafeLogOff("False")
EndFunc
Func _RunVM($vmAction,$vmpath)
Run(@ProgramFilesDir & $vmAction & $vmpath & '"', @ProgramFilesDir & "\VMware\VMware Workstation\",@SW_HIDE)
sleep(5000)
EndFunc
Func _Countdown($MaxTime)
$timer = TimerInit()
While TimerDiff($timer) < $MaxTime
$Seconds = TimerDiff($timer)/1000
$diff = $Seconds - ($MaxTime/1000)
$Hours = Int($diff / 3600)
$Minutes = Int($diff/ 60)
if ($Minutes*-1 >60) Then
$tHours = $Hours*60
$Minutes = $Minutes-$tHours
EndIf
$SecondsRem = $diff - ($Minutes * 60) - ($Hours*3600)
$Minutes = $Minutes * -1
$SecondsRem = $SecondsRem * -1
$Hours = $Hours * -1
$CountdownTimer = StringFormat("%01i:%02i:%02i", $Hours, $Minutes, $SecondsRem)
ToolTip("Current Run: " & $x & @CRLF & "Time Remaining: " & $CountdownTimer, 1920, 1)
WEnd
EndFunc
Func _Breaktime($MaxTime)
$timer = TimerInit()
While TimerDiff($timer) < $MaxTime
$Seconds = TimerDiff($timer)/1000
$diff = $Seconds - ($MaxTime/1000)
$Hours = Int($diff / 3600)
$Minutes = Int($diff/ 60)
if ($Minutes*-1 >60) Then
$tHours = $Hours*60
$Minutes = $Minutes-$tHours
EndIf
$SecondsRem = $diff - ($Minutes * 60) - ($Hours*3600)
$Minutes = $Minutes * -1
$SecondsRem = $SecondsRem * -1
$Hours = $Hours * -1
$CountdownTimer = StringFormat("%01i:%02i:%02i", $Hours, $Minutes, $SecondsRem)
ToolTip("Break Time: " & $x & @CRLF & "Break Time Remaining: " & $CountdownTimer, 1920, 1)
WEnd
EndFunc
Func _SafeLogOff($value)
IniWrite($sDscanpath, "GroupVars", "Safelogoff", $value)
EndFunc
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 0
EndFunc