von ds10 » 10 Nov 2015, 10:54
Hier der Quellcode für das Autohotkey-Skript der THCRecorder.exe
Code: Alles auswählen
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <myemail@nowhere.com>
;
; Script Function:
; Template AutoHotkey script.
;
#NoEnv
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1
FormatTime,lastModified,,yyyyMMddHHmmss
Process, Exist, CinergyDvr.exe
If ErrorLevel
{
WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , x, TerraTec Home Cinema
; Send,x
Sleep, 3000
WinActivate, TerraTec Home Cinema
ControlSend, , !{f4}, TerraTec Home Cinema
; Send,!{f4}
Sleep, 3000
Process, Exist, CinergyDvr.exe
{
if ErrorLevel
{
Process, Close, CinergyDvr.exe
; IMPORTANT: Tried in Windows 2000 only.
; It works great for me, may need tweak for others.
; It only works with ONE row of icons in the systray.
; (it would need tweaking to pass through multiple rows of icons)
; My systray is located at the standard place: lower right part of screen.
CoordMode, Mouse, Screen
SendMode Input ; You can try "Event" or "Play" for testing the difference
; Get the Y coordinate of the whole task bar, including system tray (Y is enough)
WinGetPos,,Ytaskbar,,,ahk_class Shell_TrayWnd
; Get the specific position of the system tray area, which is a control (X and Width are enough)
ControlGetPos,Xsystray,,Width,,ToolbarWindow321,ahk_class Shell_TrayWnd
; Get current mouse position (to reposition when done)
MouseGetPos, xpos, ypos
; Calculate Y where mouse will move to [= taskbar's Y + a little bit. 12 works ok for me]
yp:=Ytaskbar+12
; Calculate the maximum X where the mouse can go
maxX:=Xsystray+Width
; Calculate initial X coordinate [= systray's X + a little bit. 5 works ok for me]
xp:=Xsystray+5
; Block user mouse moves (not really necessary, but just in case)
BlockInput,MouseMove
; DEBUG: uncomment the following line for benchmarking
; StartTime := A_TickCount
; Start loop to move the mouse
Loop
{
; if the mouse is moved passed the maximum X, it's done. Exit loop
if xp>%maxX%
break
; Move mouse!
MouseMove, %xp%,%yp%
; increment X by 18 (icon width plus 1 or 2 pixels)
xp:=xp+18
; sendmode Input needs at least sleep,1. If using Sendmode Play/Event you can comment out the following like
sleep,1
}
; Reposition the mouse where it was before staring the script
MouseMove, xpos, ypos
; Unblock user mouse moves
BlockInput,MouseMoveOff
; DEBUG: uncomment the following 2 lines for benchmarking
; ElapsedTime := A_TickCount - StartTime
; MsgBox, %ElapsedTime% milliseconds have elapsed.
}
}
}
min := -1
nosilent := 0
useList := 0
withName := 0
Loop, %0%
{
if(%A_Index% = "/clean")
{
RegRead, allapp, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Common AppData
FileDelete, %allapp%\TerraTec\CinergyDVR\Timerlist.xml
}
if(%A_Index% = "/nosilent")
{
nosilent := 1
}
if(%A_Index% = "-stop")
{
ExitApp
}
if(%A_Index% = "/channel")
{
index := A_Index + 1
channel := %index%
}
if(%A_Index% = "/minimize")
{
min := 1
}
if(%A_Index% = "/list") {
useList := 1
index := A_Index + 1
listValue := %index%
}
if(%A_Index% = "/file") {
index := A_Index + 1
value := %index%
withName := 1
StringGetPos, index, value, \ , R
StringLeft, path, value, index
StringGetPos, index, value,., L
if index > 0
{
StringLen, length, value
StringRight, ext, value, length-index
StringLeft, value, value, index
}
else
{
ext := ".mpg"
}
FileAppend, %value%`n, %path%\recordings.txt
}
if(%A_Index% = "/noDateRenaming") {
FormatTime,dateFilter,,yyyy_MM_dd
}
}
if (nosilent = 0)
{
if(useList = 1)
{
Run, CinergyDvr.exe /silent /list:"%listValue%" /channel:"%channel%"
}
else
{
Run, CinergyDvr.exe /silent /channel:"%channel%"
}
}
else
{
if(useList = 1)
{
Run, CinergyDvr.exe /list:"%listValue%" /channel:"%channel%"
}
else
{
Run, CinergyDvr.exe /channel:"%channel%"
}
}
WinWait, %channel%,,25
Sleep, 1000
;WinHide, TerraTec Home Cinema
;WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , r, TerraTec Home Cinema
;Send,r
Sleep, 1000
if(min = 1)
{
WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , ^{f4}, TerraTec Home Cinema
; Send,,^{f4}
}
Process, Priority, CinergyDvr.exe , H
WinWaitClose, TerraTec Home Cinema
StringGetPos, index, value, %dateFilter%, L
if(withName = 1 and (index = 0 or index = -1))
{
ArrayCount = 0
Loop, %path%\*%ext%
{
if (A_LoopFileTimeModified > lastModified and A_LoopFileExt != "txt" and A_LoopFileName != "index.xml")
{
ArrayCount += 1
foundFile%ArrayCount% = %A_LoopFileName%
extArr%ArrayCount% = %A_LoopFileExt%
}
}
Loop %ArrayCount%
{
useFile := foundFile%A_Index%
ext := extArr%A_Index%
StringLen, testLength, useFile
if(testLength > 4)
{
FileMove, %path%\%useFile%, %value%.%ext%
}
}
}
ExitApp
Das Umbenennen wird also von der THCRecorder.exe vorgenommen.
Ist im Profil für THC in WinTVCap_GUI die Übergabe des Dateinamens mit dem Parameter
/file vorhanden?
Stimmt das in THC festgelegte Verzeichnis für die Aufnahmen mit dem im Profil für THC in WinTVCap_GUI verwendete überein?
Hier der Quellcode für das Autohotkey-Skript der THCRecorder.exe
[code];
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <myemail@nowhere.com>
;
; Script Function:
; Template AutoHotkey script.
;
#NoEnv
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1
FormatTime,lastModified,,yyyyMMddHHmmss
Process, Exist, CinergyDvr.exe
If ErrorLevel
{
WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , x, TerraTec Home Cinema
; Send,x
Sleep, 3000
WinActivate, TerraTec Home Cinema
ControlSend, , !{f4}, TerraTec Home Cinema
; Send,!{f4}
Sleep, 3000
Process, Exist, CinergyDvr.exe
{
if ErrorLevel
{
Process, Close, CinergyDvr.exe
; IMPORTANT: Tried in Windows 2000 only.
; It works great for me, may need tweak for others.
; It only works with ONE row of icons in the systray.
; (it would need tweaking to pass through multiple rows of icons)
; My systray is located at the standard place: lower right part of screen.
CoordMode, Mouse, Screen
SendMode Input ; You can try "Event" or "Play" for testing the difference
; Get the Y coordinate of the whole task bar, including system tray (Y is enough)
WinGetPos,,Ytaskbar,,,ahk_class Shell_TrayWnd
; Get the specific position of the system tray area, which is a control (X and Width are enough)
ControlGetPos,Xsystray,,Width,,ToolbarWindow321,ahk_class Shell_TrayWnd
; Get current mouse position (to reposition when done)
MouseGetPos, xpos, ypos
; Calculate Y where mouse will move to [= taskbar's Y + a little bit. 12 works ok for me]
yp:=Ytaskbar+12
; Calculate the maximum X where the mouse can go
maxX:=Xsystray+Width
; Calculate initial X coordinate [= systray's X + a little bit. 5 works ok for me]
xp:=Xsystray+5
; Block user mouse moves (not really necessary, but just in case)
BlockInput,MouseMove
; DEBUG: uncomment the following line for benchmarking
; StartTime := A_TickCount
; Start loop to move the mouse
Loop
{
; if the mouse is moved passed the maximum X, it's done. Exit loop
if xp>%maxX%
break
; Move mouse!
MouseMove, %xp%,%yp%
; increment X by 18 (icon width plus 1 or 2 pixels)
xp:=xp+18
; sendmode Input needs at least sleep,1. If using Sendmode Play/Event you can comment out the following like
sleep,1
}
; Reposition the mouse where it was before staring the script
MouseMove, xpos, ypos
; Unblock user mouse moves
BlockInput,MouseMoveOff
; DEBUG: uncomment the following 2 lines for benchmarking
; ElapsedTime := A_TickCount - StartTime
; MsgBox, %ElapsedTime% milliseconds have elapsed.
}
}
}
min := -1
nosilent := 0
useList := 0
withName := 0
Loop, %0%
{
if(%A_Index% = "/clean")
{
RegRead, allapp, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Common AppData
FileDelete, %allapp%\TerraTec\CinergyDVR\Timerlist.xml
}
if(%A_Index% = "/nosilent")
{
nosilent := 1
}
if(%A_Index% = "-stop")
{
ExitApp
}
if(%A_Index% = "/channel")
{
index := A_Index + 1
channel := %index%
}
if(%A_Index% = "/minimize")
{
min := 1
}
if(%A_Index% = "/list") {
useList := 1
index := A_Index + 1
listValue := %index%
}
if(%A_Index% = "/file") {
index := A_Index + 1
value := %index%
withName := 1
StringGetPos, index, value, \ , R
StringLeft, path, value, index
StringGetPos, index, value,., L
if index > 0
{
StringLen, length, value
StringRight, ext, value, length-index
StringLeft, value, value, index
}
else
{
ext := ".mpg"
}
FileAppend, %value%`n, %path%\recordings.txt
}
if(%A_Index% = "/noDateRenaming") {
FormatTime,dateFilter,,yyyy_MM_dd
}
}
if (nosilent = 0)
{
if(useList = 1)
{
Run, CinergyDvr.exe /silent /list:"%listValue%" /channel:"%channel%"
}
else
{
Run, CinergyDvr.exe /silent /channel:"%channel%"
}
}
else
{
if(useList = 1)
{
Run, CinergyDvr.exe /list:"%listValue%" /channel:"%channel%"
}
else
{
Run, CinergyDvr.exe /channel:"%channel%"
}
}
WinWait, %channel%,,25
Sleep, 1000
;WinHide, TerraTec Home Cinema
;WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , r, TerraTec Home Cinema
;Send,r
Sleep, 1000
if(min = 1)
{
WinShow, TerraTec Home Cinema
WinActivate, TerraTec Home Cinema
ControlSend, , ^{f4}, TerraTec Home Cinema
; Send,,^{f4}
}
Process, Priority, CinergyDvr.exe , H
WinWaitClose, TerraTec Home Cinema
StringGetPos, index, value, %dateFilter%, L
if(withName = 1 and (index = 0 or index = -1))
{
ArrayCount = 0
Loop, %path%\*%ext%
{
if (A_LoopFileTimeModified > lastModified and A_LoopFileExt != "txt" and A_LoopFileName != "index.xml")
{
ArrayCount += 1
foundFile%ArrayCount% = %A_LoopFileName%
extArr%ArrayCount% = %A_LoopFileExt%
}
}
Loop %ArrayCount%
{
useFile := foundFile%A_Index%
ext := extArr%A_Index%
StringLen, testLength, useFile
if(testLength > 4)
{
FileMove, %path%\%useFile%, %value%.%ext%
}
}
}
ExitApp[/code]
Das Umbenennen wird also von der THCRecorder.exe vorgenommen.
Ist im Profil für THC in WinTVCap_GUI die Übergabe des Dateinamens mit dem Parameter [i]/file[/i] vorhanden?
Stimmt das in THC festgelegte Verzeichnis für die Aufnahmen mit dem im Profil für THC in WinTVCap_GUI verwendete überein?