View Single Post
Old 10-06-22, 07:24 AM   #10
TORDO222
Machinist's Mate
 
Join Date: Jul 2012
Location: Argentina - Entre Rios
Posts: 129
Downloads: 166
Uploads: 23


Default

Quote:
Originally Posted by MarkShot View Post
Now, if you want something that pretty much can automatically create date/time checkpointed saves. Well, you could do this. This is WinBatch.




The program below that remaps the keyboard for easy use that you can always keep one hand on the mouse; it is AutoHotKey.



IntControl(72, 0, 0, 0, 0); Normal handler (exit)
WhoAmI="CW Mgr"
If WinExist(WhoAmI)Then Exit
WinTitle(WinName(), WhoAmI)
WinHide(WhoAmI)

; ----- Definitions ------

Interval=1
FrapsEXE="C:\Program Files (x86)\Fraps\fraps.exe"
FrapsPath="C:\Program Files (x86)\Fraps"
HotKeyScript="D:\User\MK\Software\Games\Cold Waters\Utility\ColdWatersKeys.exe"
SystemTrayRestart="C:\Program Files\SystemTrayRefresh\SystemTrayRefresh.exe"
SaveDirLeft = "E:\Games\Steam Cold Waters Data\Cold Waters\savegame"
GameEXE="D:\User\MK\Software\Games\Cold Waters\Utility\CW URL launch.exe"
GamePath="E:\Games\Steam Cold Waters"
GameName="Cold Waters~"
UtilDir=DirGet()

CoveredList=""
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign001", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign002", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign003", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign004", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign005", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign006", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign007", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign008", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign009", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign010", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign011", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign012", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign013", @TAB)
CoveredList=StrCat(CoveredList, "E:\Games\Steam Cold Waters Data\Cold Waters\savegame\campaign014")
DirCount=ItemCount(CoveredList, @TAB)

; ----- See If Saves Should be Purged -----

Notice=""
Notice=Strcat(Notice, "Keep the various save directories directory? ", @CR, @CR)
Notice=Strcat(Notice, "YES = Keep all game history.", @CR)
Notice=Strcat(Notice, "No = Purge all game history.", @CR)
Notice=Strcat(Notice, "Cancel = Exit out.", @CR)
Beep
UserResponse=AskYesNo('CW Mgr', Notice)

If UserResponse==@No Then

For DirIndex = 1 to DirCount

DirName=ItemExtract(DirIndex, CoveredList, @Tab)

SourceDir=StrCat(DirName)

If DirExist(SourceDir) Then
Mask=StrCat(SourceDir, "\*.sav")
FileDelete(Mask)
Mask=StrCat(SourceDir, "\*.bat")
FileDelete(Mask)
End If

Next

EndIf

; ----- Start game ----

Run(FrapsEXE,"")
RunShell(GameEXE, "", ".", @NORMAL, @NOWAIT); must RunShell
WinWaitExist(GameName, -1)
WinActivate(GameName)
Run(HotKeyScript,"")
Delay(2)
WinActivate(GameName)
WinShow(GameName)

Delay(10)

While WinExist(GameName)

; ------- Capture Screens -----

ErrorMode(@OFF)
FileMove ("E:\FRAPS\ScreenFrap\*.jpg", "E:\FRAPS\ScreenFrap\CWFraps", @TRUE)
ErrorMode(@CANCEL)

CurrentDir=DirGet()
DirChange("E:\FRAPS\ScreenFrap\CWFraps")
ShotFileName=FileItemize("ColdWaters*.jpg")
If ShotFileName<>"" Then
CancelFlag=@False
IntControl(72, 1, 0, 0, 0); 01/26/22 fix to use error handler
Prompt=StrCat("Enter The Suffix Text")
WinShow(WhoAmI)
SaveSuffix=AskLine("SaveSuffix", Prompt, "", 0)
WinHide(WhoAmI)
Goto SKIP
:CANCEL
WinHide(WhoAmI)
CancelFlag=@True
:SKIP
If CancelFlag Then
FileDelete(ShotFileName)
Else
Base=StrSub(ShotFileName, 12, 19)
If SaveSuffix<>"" Then
NewFileName=StrCat(Base, " ", SaveSuffix, ".jpg")
Else
NewFileName=StrCat(Base, ".jpg")
End If
FileRename(ShotFileName, NewFileName)
Beep()
End If
WinActivate(GameName)
End IF
DirChange(CurrentDir)

; ------- Checkpoint Saves -----

FoundIt=@false
CurrentDir=DirGet()
For DirIndex = 1 to DirCount

DirName=ItemExtract(DirIndex, CoveredList, @Tab)

SourceDir=StrCat(DirName)

If DirExist(SourceDir) Then
DirChange(SourceDir)
Mask=StrCat(SourceDir, "\*.sav")
SaveList=FileItemize(Mask)
SaveCount=ItemCount(SaveList, @TAB)

For SaveIndex = 1 to SaveCount

SaveName=ItemExtract(SaveIndex, SaveList, @Tab)
attr=FileAttrGet(SaveName)
If StrSub(attr, 2, 1) == "A" Then
BaseName=FileTimeGetEx(SaveName, 2)
ReplaceName=StrClean(BaseName, ":", "", @False, 1)
ReplaceName=StrSub(ReplaceName, 1, 14)
ReplaceName=StrCat(StrSub(ReplaceName, 3, 6), " ", StrSub(ReplaceName, 9, 6), ".sav")
TargetName=ReplaceName
;Message("Debug1", SaveName)
;Message("Debug2", TargetName)
FileRename(SaveName, TargetName)
FileAttrSet(TargetName, "a") ; clear the flag
FoundIt=@True
SetFile="cwsetenv.bat"
If FileExist(SetFile) then ; Get rid of old output
FileDelete(SetFile)
End If
HandleOut=FileOpen(SetFile, "APPEND")
LineOut=StrCat("setx CWSAVEDIR ", '"', SourceDir, '"')
FileWrite(HandleOut, LineOut)
FileClose(HandleOut)
RunShell("cwsetenv.bat", "", "", @HIDDEN, @WAIT)
If FileExist(SetFile) then ; Get rid of old output
FileDelete(SetFile)
End If
End If

If FoundIt Then Break
Next

End If

If FoundIt Then Break
Next
DirChange(CurrentDir)

TimeDelay(Interval)
End While

; ----- Kill AutoHotKey -----

Addextender("wwprc44i.dll")

Goto SkipKill

ProgramEXE="AutoHotKey|"

Processlist=tListProc() ; get list
ptr1=StrIndexNC(processlist,ProgramEXE,0,@fwdscan)
;Message("Debug list",Processlist)

While ptr1<>0 ; terminate while processes left
ptr2=StrIndex(processlist,"|",ptr1,@fwdscan)
ptr3=StrIndex(processlist,@tab,ptr2,@fwdscan)
if ptr3==0;if last item in list
pid=Strsub(processlist,ptr2+1,-1)
ptr1=0 ; last one killed
else
pid=Strsub(processlist,ptr2+1,ptr3-ptr2-1)
ptr1=ptr3 ; set up for next process
ptr1=StrIndexNC(processlist,ProgramEXE,ptr1,@fwdsc an)
endif
;Message("Debug pid",pid)
hProcess=tOpenProc(pid,3) ; mark able to terminate
TKillProc(hProcess) ; terminate
TCloseProc(hProcess) ; terminate
End While

:SkipKill

ProgramEXE="fraps|"

Processlist=tListProc() ; get list
ptr1=StrIndexNC(processlist,ProgramEXE,0,@fwdscan)
;Message("Debug list",Processlist)

While ptr1<>0 ; terminate while processes left
ptr2=StrIndex(processlist,"|",ptr1,@fwdscan)
ptr3=StrIndex(processlist,@tab,ptr2,@fwdscan)
if ptr3==0;if last item in list
pid=Strsub(processlist,ptr2+1,-1)
ptr1=0 ; last one killed
else
pid=Strsub(processlist,ptr2+1,ptr3-ptr2-1)
ptr1=ptr3 ; set up for next process
ptr1=StrIndexNC(processlist,ProgramEXE,ptr1,@fwdsc an)
endif
;Message("Debug pid",pid)
hProcess=tOpenProc(pid,3) ; mark able to terminate
TKillProc(hProcess) ; terminate
TCloseProc(hProcess) ; terminate
End While
Delay(1)
Run(SystemTrayRestart, "")

ProgramEXE="fraps64.dat|"

Processlist=tListProc() ; get list
ptr1=StrIndexNC(processlist,ProgramEXE,0,@fwdscan)
;Message("Debug list",Processlist)

While ptr1<>0 ; terminate while processes left
ptr2=StrIndex(processlist,"|",ptr1,@fwdscan)
ptr3=StrIndex(processlist,@tab,ptr2,@fwdscan)
if ptr3==0;if last item in list
pid=Strsub(processlist,ptr2+1,-1)
ptr1=0 ; last one killed
else
pid=Strsub(processlist,ptr2+1,ptr3-ptr2-1)
ptr1=ptr3 ; set up for next process
ptr1=StrIndexNC(processlist,ProgramEXE,ptr1,@fwdsc an)
endif
;Message("Debug pid",pid)
hProcess=tOpenProc(pid,3) ; mark able to terminate
TKillProc(hProcess) ; terminate
TCloseProc(hProcess) ; terminate
End While

Delay(1)
Run(SystemTrayRestart, "")



---------------------------------


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
#Persistent
#NoTrayIcon
SetTitleMatchMode 3

Game01 = Cold Waters

TimerInterval = 1000

SetTitleMatchMode 1
CoordMode, Mouse, Screen

SetTimer, ScriptDone, %TimerInterval%
return

ScriptDone:

IfWinNotExist,%Game01%,
ExitApp

Return

#IfWinActive, Cold Waters,

F9:: ;View Static
{
Send {LShift Down}
Sleep 300
Send {F4 Down}
Sleep 300
Send {F4 Up}
Sleep 300
Send {LShift Up}
Return
}

F10:: ;View Event
{
Send {LShift Down}
Sleep 300
Send {e Down}
Sleep 300
Send {e Up}
Sleep 300
Send {LShift Up}
Return
}

F11:: ;View Bearing
{
Send {u Down}
Sleep 300
Send {u Up}
Return
}

`:: ;HUD
{
Send {F10 Down}
Sleep 300
Send {F10 Up}
Return
}

5:: ;Cut Wire
{
Send {LShift Down}
Sleep 300
Send {4 Down}
Sleep 300
Send {4 Up}
Sleep 300
Send {LShift Up}
Return
}

6:: ;SAM
{
Send {LShift Down}
Sleep 300
Send {Space Down}
Sleep 300
Send {Space Up}
Sleep 300
Send {LShift Up}
Return
}

7:: ;Peri up/dn
{
Send {0 Down}
Sleep 300
Send {0 Up}
Return
}

8:: ;Peri view
{
Send {p Down}
Sleep 300
Send {p Up}
Return
}

0:: ;Radar up/dn
{
Send {8 Down}
Sleep 300
Send {8 Up}
Return
}

-:: ;Active Sonar
{
Send {LShift Down}
Sleep 300
Send {a Down}
Sleep 300
Send {a Up}
Sleep 300
Send {LShift Up}
Return
}

=:: ;Towed Array
{
Send {Backspace Down}
Sleep 300
Send {Backspace Up}
Return
}
Backspace:: ; Mark Kratzer
{
Send `b
Sleep 200
Sleep 200
Send M
Sleep 200
Send a
Sleep 200
Send r
Sleep 200
Send k
Sleep 200
Send {space}
Sleep 200
Send K
Sleep 200
Send r
Sleep 200
Send a
Sleep 200
Send t
Sleep 200
Send z
Sleep 200
Send e
Sleep 200
Send r
Sleep 2000
Send {Enter}
Return
}

q:: ;Decrease depth
{
Send {PgUp Down}
Sleep 50
Send {PgUp Up}
Return
}

w:: ;Decrease depth less
{
Send {LShift Down}
Sleep 50
Send {PgUp Down}
Sleep 50
Send {PgUp Up}
Sleep 50
Send {LShift Up}
Return
}

e:: ;Log
{
Send {LShift Down}
Sleep 300
Send {l Down}
Sleep 300
Send {l Up}
Sleep 300
Send {LShift Up}
Return
}

i:: ;LLTV
{
Send {o Down}
Sleep 300
Send {o Up}
Return
}

a:: ;Increase depth
{
Send {PgDn Down}
Sleep 50
Send {PgDn Up}
Return
}

s:: ;Increase depth less
{
Send {LShift Down}
Sleep 50
Send {PgDn Down}
Sleep 50
Send {PgDn Up}
Sleep 50
Send {LShift Up}
Return
}

d:: ;Previous contact
{
Send {y Down}
Sleep 300
Send {y Up}
Return
}

f:: ;Next contact
{
Send {t Down}
Sleep 300
Send {t Up}
Return
}

z:: ;Mark
Send {Control Down}
Sleep 300
Send {i Down}
Sleep 300
Send {i Up}
Sleep 300
Send {Control Up}
Return

x:: ;Manual
Send {Control Down}
Sleep 300
Send {m Down}
Sleep 300
Send {m Up}
Sleep 300
Send {Control Up}
Return

c:: ;Previous console
{
Send {; Down}
Sleep 300
Send {; Up}
Return
}

v:: ;Next console
{
Send {' Down}
Sleep 300
Send {' Up}
Return
Good Job!.we will test. Thanks!.Greetings!
__________________
"Fire!!! that the People look at us! " - Admiral Guillermo Brown.
Order prior to the "Battle of Los Pozos" that took place on June 11,1826 in the Rio de La Plata,in front of the city of Buenos Aires, in an area of relative greater depth and to the view from the population. Was a combat between a flimsy Argentine Squadron and the powerfull Brazilian Empire Fleet.It was a victorious day for the Argentine navy.William Brown was the first Admiral of the newly formed Argentine Navy.Born in Ireland and argentine by adoption.A great patriot.
TORDO222 is offline   Reply With Quote