home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Language specific support
Deutsches MediaPortal Forum
Plugins & Skins für das MediaPortal
Plugins & Erweiterungen
VBSkript für regelmässiges Neustart
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="larry_S" data-source="post: 487712" data-attributes="member: 85587"><p>Müsste so funktionieren (mit MS SQL Server).</p><p></p><p>Script für Taskplaner:</p><p>[CODE]set ws = CreateObject("Wscript.shell")</p><p>set db1 = createobject ("ADODB.connection")</p><p>Set FSO = CreateObject("Scripting.FileSystemObject")</p><p></p><p>SQLServer= "Server\SQLEXPRESS"</p><p>SQLUser= "sa"</p><p>SQLPW= "mediaportal"</p><p>DWH= "MpTvDb"</p><p></p><p>Quelldatei= "C:\start.vbs"</p><p>Zieldatei = "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Autostart\standy.vbs"</p><p></p><p>Zeitdiff=10</p><p></p><p>db1.Open("Driver={SQL Server};SERVER="&SQLServer&";Database="&DWH&";User ID="&SQLUser&";Password="&SQLPW)</p><p> set rs1=db1.execute("SELECT min(Starttime) as start from " & _</p><p> "( select Starttime, Endtime " & _</p><p> " from schedule " & _</p><p> " where scheduleType=0 " & _</p><p> " union " & _</p><p> " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),heute)) as startime, " & _</p><p> " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),heute)) as endtime " & _</p><p> " from schedule " & _</p><p> " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _</p><p> " on 1=1 " & _</p><p> " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,heute)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,heute) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,heute) in (6,7)) " & _</p><p> " union " & _</p><p> " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),morgen)) as startime, " & _</p><p> " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),morgen)) as endtime " & _</p><p> " from schedule " & _</p><p> " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _</p><p> " on 1=1 " & _</p><p> " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,morgen)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,morgen) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,morgen) in (6,7)) " & _</p><p> " union " & _</p><p> " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),gestern)) as startime, " & _</p><p> " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),gestern)) as endtime " & _</p><p> " from schedule " & _</p><p> " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _</p><p> " on 1=1 " & _</p><p> " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,gestern)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,gestern) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,gestern) in (6,7)) " & _</p><p> ") as ua " & _</p><p> "where endTime>current_timestamp")</p><p></p><p> if isdate(rs1("Start")) then 'Wenn Aufnahmen läuft... oder in 10 Minuten startet</p><p> if rs1("Start")<now() then</p><p> WScript.Sleep 60000</p><p></p><p> fso.copyfile Quelldatei, Zieldatei</p><p></p><p> ws.AppActivate "MediaPortal", True</p><p> ws.sendkeys "+(ü)", True</p><p> WScript.Sleep 1000</p><p> ws.sendkeys "{LEFT}"</p><p> ws.sendkeys "{ENTER}"</p><p> end if</p><p> end if</p><p> db1.close[/CODE]</p><p></p><p>Script 2:</p><p>[CODE]set ws = CreateObject("Wscript.shell")</p><p>Set FSO = CreateObject("Scripting.FileSystemObject")</p><p></p><p>Zieldatei = "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Autostart\standy.vbs"</p><p></p><p>WScript.Sleep 120000</p><p>fso.deletefile Zieldatei</p><p>ws.AppActivate "MediaPortal", True</p><p>ws.sendkeys "q"</p><p>[/CODE]</p><p></p><p>Gruß</p><p>Larry</p></blockquote><p></p>
[QUOTE="larry_S, post: 487712, member: 85587"] Müsste so funktionieren (mit MS SQL Server). Script für Taskplaner: [CODE]set ws = CreateObject("Wscript.shell") set db1 = createobject ("ADODB.connection") Set FSO = CreateObject("Scripting.FileSystemObject") SQLServer= "Server\SQLEXPRESS" SQLUser= "sa" SQLPW= "mediaportal" DWH= "MpTvDb" Quelldatei= "C:\start.vbs" Zieldatei = "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Autostart\standy.vbs" Zeitdiff=10 db1.Open("Driver={SQL Server};SERVER="&SQLServer&";Database="&DWH&";User ID="&SQLUser&";Password="&SQLPW) set rs1=db1.execute("SELECT min(Starttime) as start from " & _ "( select Starttime, Endtime " & _ " from schedule " & _ " where scheduleType=0 " & _ " union " & _ " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),heute)) as startime, " & _ " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),heute)) as endtime " & _ " from schedule " & _ " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _ " on 1=1 " & _ " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,heute)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,heute) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,heute) in (6,7)) " & _ " union " & _ " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),morgen)) as startime, " & _ " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),morgen)) as endtime " & _ " from schedule " & _ " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _ " on 1=1 " & _ " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,morgen)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,morgen) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,morgen) in (6,7)) " & _ " union " & _ " select dateadd(mi,datepart(mi,starttime)-(preRecordInterval) -"&Zeitdiff&" ,dateadd(hh,datepart(hh,starttime),gestern)) as startime, " & _ " dateadd(mi,datepart(mi,endtime)+(PostRecordInterval)+"&Zeitdiff&" ,dateadd(hh,datepart(hh,endtime),gestern)) as endtime " & _ " from schedule " & _ " inner join (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) as heute,DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE())) as gestern, DATEADD(dd, +1, DATEDIFF(dd, 0, GETDATE())) as morgen ) as UA " & _ " on 1=1 " & _ " where scheduleType in(1,3,4) or (scheduleType=2 and datepart(dw,gestern)=datepart(dw,starttime)) or (scheduleType=6 and datepart(dw,gestern) in (1,2,3,4,5)) or (scheduleType=5 and datepart(dw,gestern) in (6,7)) " & _ ") as ua " & _ "where endTime>current_timestamp") if isdate(rs1("Start")) then 'Wenn Aufnahmen läuft... oder in 10 Minuten startet if rs1("Start")<now() then WScript.Sleep 60000 fso.copyfile Quelldatei, Zieldatei ws.AppActivate "MediaPortal", True ws.sendkeys "+(ü)", True WScript.Sleep 1000 ws.sendkeys "{LEFT}" ws.sendkeys "{ENTER}" end if end if db1.close[/CODE] Script 2: [CODE]set ws = CreateObject("Wscript.shell") Set FSO = CreateObject("Scripting.FileSystemObject") Zieldatei = "C:\Dokumente und Einstellungen\All Users\Startmenü\Programme\Autostart\standy.vbs" WScript.Sleep 120000 fso.deletefile Zieldatei ws.AppActivate "MediaPortal", True ws.sendkeys "q" [/CODE] Gruß Larry [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Language specific support
Deutsches MediaPortal Forum
Plugins & Skins für das MediaPortal
Plugins & Erweiterungen
VBSkript für regelmässiges Neustart
Contact us
RSS
Top
Bottom