nuts Posted March 18, 2016 Share Posted March 18, 2016 (edited) Hi, this thread is for english questions about some small scripts I created for the DVBViewer Pro. German thread with download and "how to" in german: http://www.DVBViewer.tv/forum/topic/57636-myextendedexit-myactions-mysleeptimer-myprocesstaks-mybackup/?p=444219 Currently there is no english tutorial available how to use this script, but feel free to ask and I will try to help you. Some quick words how to install these script: 1. download myscripts.zip from here: http://www.DVBViewer.tv/forum/topic/57636-myextendedexit-myactions-mysleeptimer-myprocesstaks-mybackup/?p=444219 2. unzip myscripts.zip 3. run my_scripts_install.bat to create OSD entries for myExtendedExit, myActions and mySleeptimer Greetings Nuts Edited March 18, 2016 by nuts Quote Link to comment
cuppie Posted March 25, 2016 Share Posted March 25, 2016 Hi Nuts, Many thanks for the language modification ! I've also another question: Currently i'm struggling with windows 10 wakeup's from windows updates. I've tested many things , but Windows 10 keeps waking up for reboot. On the internet there are many post to modify this behaviour like this: http://superuser.com/questions/973009/conclusively-stop-wake-timers-from-waking-windows-10-desktop/973029#973029 But none are working fine for me. So i'm thinking about to let windows 10 do , what it want't to do : install updates / reboot. But the only anoying is , that the CEC adapter does power on the TV. So I would like to check , which process , wakes the PC. Sort of this discussion is already here http://www.DVBViewer.tv/forum/topic/48290-einbindung-von-libcec/page-5 (Cinch is talking about this in German) Currently i've autohotkey active , for this kind of aditional triggers , but I would realy like to detect the wake-up cause in your scripts. Would you like to have a look on this ? Many thanks ! Kind regards Cuppie Quote Link to comment
nuts Posted March 25, 2016 Author Share Posted March 25, 2016 Hm I thought my scripts should ignore wake ups by the system or tasks and react only on wake ups triggert by the user? This doesnt work for you? Quote Link to comment
cuppie Posted March 25, 2016 Share Posted March 25, 2016 Not sure about that. But the facts I are : - the cec adapter sends the "power on" command to the tv. - DVBViewer.exe is started. In the event viewer , the wake up cause is "unknown" But from that last , i'm sure it's the "reload" schdedule from task manger. Currently i've exactly the same setup , with a schedule that expires tonight at 0:34. Quote Link to comment
cuppie Posted March 25, 2016 Share Posted March 25, 2016 When i use my ir-remote , to power on the tv , the wake up case in the event viewer is : "power button" Quote Link to comment
nuts Posted March 25, 2016 Author Share Posted March 25, 2016 Hm ok ... Is "extendedlog" for my scripts enabled? If yes: Could you please post the log at 0.34? Otherwise please enable logging (Extendedlog=1 in the config file). Quote Link to comment
cuppie Posted March 26, 2016 Share Posted March 26, 2016 Just forgot the correct trustees on the myscripts dir.... missed the logs... But i've made the log manually , and just scheduled a task , with wakeup ********************************** Log with a scheduled task : ********************************** 2016-03-26 20:51:52 : Exit myExtendedExit - Version: 1.0 2016-03-26 20:51:52 : run="C:\Program Files (x86)\DVBViewer\DVBViewer.exe" -x53 2016-03-26 20:51:52 : cec=on 0 2016-03-26 20:51:52 : cec=as 2016-03-26 20:51:52 : run="C:\Program Files (x86)\DVBViewer\DVBViewer.exe" -c1 2016-03-26 20:51:52 : runwait="C:\ProgramData\my_scripts\resume-DVBViewer.cmd" 2016-03-26 20:51:52 : cec=as 2016-03-26 20:51:52 : cec=on 0 2016-03-26 20:51:52 : section "Resume" 2016-03-26 20:51:52 : log=section "Resume" 2016-03-26 20:51:52 : _run_section => section=Resume 2016-03-26 20:51:52 : Func _Resume 2016-03-26 20:50:44 : shutdownmode=32 Vargettype= String 2016-03-26 20:50:44 : resume=1 2016-03-26 20:50:44 : shutdown=32 2016-03-26 20:50:44 : cec=standby 0 2016-03-26 20:50:43 : sleep=1 2016-03-26 20:50:43 : runwait="C:\ProgramData\my_scripts\sleep-DVBViewer.cmd" 2016-03-26 20:50:43 : sendcommand=12326 2016-03-26 20:50:43 : cec=standby 0 2016-03-26 20:50:43 : _run_section => section=Standby 2016-03-26 20:50:43 : myExtendedExit: cmdline[1] = Standby 2016-03-26 20:50:42 : Startup myExtendedExit Version: 1.0 C:\WINDOWS\system32>powercfg -lastwake Wake History Count - 1 Wake History [0] Wake Source Count - 0 ************************************ Log with wake with ir-remote: ************************************ 2016-03-26 20:57:11 : Exit myExtendedExit - Version: 1.0 2016-03-26 20:57:11 : run="C:\Program Files (x86)\DVBViewer\DVBViewer.exe" -x53 2016-03-26 20:57:11 : cec=on 0 2016-03-26 20:57:11 : cec=as 2016-03-26 20:57:11 : run="C:\Program Files (x86)\DVBViewer\DVBViewer.exe" -c1 2016-03-26 20:57:11 : runwait="C:\ProgramData\my_scripts\resume-DVBViewer.cmd" 2016-03-26 20:57:11 : cec=as 2016-03-26 20:57:11 : cec=on 0 2016-03-26 20:57:11 : section "Resume" 2016-03-26 20:57:11 : log=section "Resume" 2016-03-26 20:57:11 : _run_section => section=Resume 2016-03-26 20:57:11 : Func _Resume 2016-03-26 20:56:49 : shutdownmode=32 Vargettype= String 2016-03-26 20:56:49 : resume=1 2016-03-26 20:56:49 : shutdown=32 2016-03-26 20:56:49 : cec=standby 0 2016-03-26 20:56:48 : sleep=1 2016-03-26 20:56:48 : runwait="C:\ProgramData\my_scripts\sleep-DVBViewer.cmd" 2016-03-26 20:56:48 : sendcommand=12326 2016-03-26 20:56:48 : cec=standby 0 2016-03-26 20:56:48 : _run_section => section=Standby 2016-03-26 20:56:48 : myExtendedExit: cmdline[1] = Standby 2016-03-26 20:56:48 : Startup myExtendedExit Version: 1.0 C:\WINDOWS\system32>powercfg -lastwake Wake History Count - 1 Wake History [0] Wake Source Count - 1 Wake Source [0] Type: Fixed Feature Power Button ********************** So I think it should be possible somehow , to detect the poweron method. And when this is possible , only when the pc is woken up by power button , the cec command will be send , to power-on the tv. When the PC is woken by schedule , the cec command will not be send ( and maybe some schutdown schedule will be set) Cuppie Quote Link to comment
nuts Posted March 29, 2016 Author Share Posted March 29, 2016 Hm ok seems like we need another testversion with addional logging. I will upload it soon here. Quote Link to comment
majstang Posted March 29, 2016 Share Posted March 29, 2016 (edited) Sorry for my interferrance. Just wanted to present my Autohotkey code im using for this exact thing. It might give some clues to the problem. Windows 10 messages are a bit different. Im monitoring these messages with success to accomplish this very exact thing. Important to clear the memory regularly. onmessage(0x11, "on_shutdown") ;WM_QUERYENDSESSION onmessage(0x218, "on_shutdown") ;WM_POWERBROADCAST ;---------------------------------------------------------start timer to clear memory every 10 minutes. end autoexecute. settimer, emptymem, 60000 return ;---------------------------------------------------------function to be called on shutdown or log out etc. on_shutdown(param1, param2) { if ((param1 = 0) && (param2 = 0)) ; shutdown AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "System shutdown.`r`n") if (param2 = 1073741824) ; restart AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "System restart.`r`n") if (param2 = -2147483648) ; log out AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "System log out.`r`n") if (param1 = 4) ; hibernate AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "Entering system hibernation.`r`n") if (param1 = 18) ; resume from hibernation scheduled timer/task AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "Resume from hibernation.`r`n") if (param1 = 7) { ; resume from hibernation from power button AddToBOF("log.txt", a_yyyy "-" a_mm "-" a_dd " " a_hour ":" a_min " - " "Resume from hibernation.`r`n") } ;---------------------------------------------------------clear memory. emptymem: { dllcall("psapi.dll\EmptyWorkingSet", "UInt", -1) } return Edited March 29, 2016 by majstang Quote Link to comment
nuts Posted March 30, 2016 Author Share Posted March 30, 2016 Thanks for your input. This looks like there is nothing special for Win10? https://msdn.microsoft.com/de-de/library/windows/desktop/aa373247(v=vs.85).aspx I though my scripts would take care of this but maybe there is a bug? Testscript is coming this evening. Quote Link to comment
nuts Posted March 30, 2016 Author Share Posted March 30, 2016 Here we go. @cuppie: Could you please do some test with this versions @Win10? I am interested in a log with wake up triggert by user input (i.e. powerbutton) and a log when the system resumes by task without user input. Anyway I am doing this: Func _MY_WM_POWERBROADCAST($hWnd, $msg, $wParam, $lParam) ; receiving WM_POWERBROADCAST messages If $writelog Then _FileWriteLog($my_scripts_log, "Debug wakeup - $wParam: "&$wParam, 1) ;debug Switch $wParam Case $PBT_APMRESUMESUSPEND ; this message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key ; $PBT_APMRESUMESUSPEND = 0x00000007 ;7 (0x7) ; erste Benutzeraktion nach dem Standby (manuelles Aufwecken zählt als erste Benutzeraktion) If $writelog then _FileWriteLog($my_scripts_log, "$PBT_APMRESUMESUSPEND="&$wParam, 1) ;debug If $wait4resume Then _Resume() ; run resume section after wakeup by user input (i.e. power button) Case $PBT_APMRESUMEAUTOMATIC ; This message is sent every time the system resumes. ; $PBT_APMRESUMEAUTOMATIC=0x00000012 ;18 (0x12) If $writelog then _FileWriteLog($my_scripts_log, "$PBT_APMRESUMEAUTOMATIC="&$wParam, 1) ;debug If $wait4resume Then HotKeySet("^r", "_resume") ; special for imon devices (tüftler) - should not do anything if you don't use the "strg+r" hotkey EndSwitchEndFunc ;==>_MY_WM_POWERBROADCAST I think I did it right? Maybe something special with Win10 (can not test @Win10 ...)? @majstang What do you think? myExtendedExit.zip Quote Link to comment
majstang Posted April 1, 2016 Share Posted April 1, 2016 (edited) I think I did it right? Maybe something special with Win10 (can not test @Win10 ...)? @majstang What do you think? Hi nuts! The powerbroadcast messages seem to be the same regardless of Windows version, however in my case on my old Win7 system I got logs for both resume hibernate from scheduled timer/task and resume hibernate from power button by only monitoring PBT_APMRESUMESUSPEND. On Win10 no more logs for resume from hibernate scheduled timer/task until starting monitoring PBT_APMRESUMEAUTOMATIC. So there seem to be a Win api handling difference at least between these OS:es. I dont know if that applies to this case though. Im not using your script cuz I like to use my own. We will see what results cuppie gets Regards majstang Edited April 1, 2016 by majstang Quote Link to comment
cuppie Posted April 5, 2016 Share Posted April 5, 2016 Hi, Sorry for the delay.... Still running on windows 10. When I schedule an action with windows task manager , and enable "wake-up from sleep" in the task. The following logs are generated from extended-exit. To be clear , the task was scheduled at 16:21:00 2016-04-05 16:22:14 : Startup myExtendedExit Version: 1.1 2016-04-05 16:21:06 : Exit myExtendedExit - Version: 1.1 2016-04-05 16:21:06 : run="C:\ProgramData\my_scripts\resume-DVBViewer.cmd" 2016-04-05 16:21:06 : section "Resume" 2016-04-05 16:21:06 : log=section "Resume" 2016-04-05 16:21:06 : _run_section => section=Resume 2016-04-05 16:21:06 : Func _Resume 2016-04-05 16:21:06 : $PBT_APMRESUMESUSPEND=0x00000007 2016-04-05 16:21:06 : Debug wakeup - $wParam: 0x00000007 2016-04-05 16:19:58 : shutdownmode=32 Vargettype= String 2016-04-05 16:19:58 : resume=1 2016-04-05 16:19:58 : shutdown=32 2016-04-05 16:19:58 : cec=standby 0 2016-04-05 16:19:57 : sleep=1 2016-04-05 16:19:53 : runwait="C:\ProgramData\my_scripts\sleep-DVBViewer.cmd" 2016-04-05 16:19:53 : sendcommand=12326 2016-04-05 16:19:53 : cec=standby 0 2016-04-05 16:19:53 : _run_section => section=Standby 2016-04-05 16:19:53 : myExtendedExit: cmdline[1] = Standby 2016-04-05 16:19:53 : Startup myExtendedExit Version: 1.1 When I resume the pc with the ir remote : 2016-04-05 16:12:53 : Exit myExtendedExit - Version: 1.1 2016-04-05 16:12:53 : run="C:\ProgramData\my_scripts\resume-DVBViewer.cmd" 2016-04-05 16:12:53 : section "Resume" 2016-04-05 16:12:53 : log=section "Resume" 2016-04-05 16:12:53 : _run_section => section=Resume 2016-04-05 16:12:53 : Func _Resume 2016-04-05 16:12:52 : $PBT_APMRESUMESUSPEND=0x00000007 2016-04-05 16:12:52 : Debug wakeup - $wParam: 0x00000007 2016-04-05 15:55:54 : shutdownmode=32 Vargettype= String 2016-04-05 15:55:54 : resume=1 2016-04-05 15:55:54 : shutdown=32 2016-04-05 15:55:54 : cec=standby 0 2016-04-05 15:55:53 : sleep=1 2016-04-05 15:55:49 : runwait="C:\ProgramData\my_scripts\sleep-DVBViewer.cmd" 2016-04-05 15:55:49 : False 2016-04-05 15:55:49 : We intercepted a COM Error ! Number is: 80020006 Windescription is: Onbekende naam. 2016-04-05 15:55:49 : sendcommand=12326 2016-04-05 15:55:49 : cec=standby 0 2016-04-05 15:55:49 : _run_section => section=Standby 2016-04-05 15:55:49 : myExtendedExit: cmdline[1] = Standby 2016-04-05 15:55:49 : myExtendedExit Error: _DVBV-Connect 2016-04-05 15:55:49 : We intercepted a COM Error ! Number is: 80020006 Windescription is: Onbekende naam. 2016-04-05 15:55:49 : Startup myExtendedExit Version: 1.1 as far as i can see there is no diffence between wakeup types. last week I've also been searching with google , for triggers in autohotkey or autoit to detect the wakeup cause. The only thing i've really learned , is that I'm not the only one. I'm currently running with these commands in my batch file "resume-DVBViewer.cmd" : powercfg -lastwake | find "Power Button" > nul if %ERRORLEVEL% neq 1 ( "C:\ProgramData\my_scripts\tv-on.exe" Start /D "C:\Program Files (x86)\DVBViewer" /B DVBViewer.exe -c1 GOTO EOF ) powercfg -lastwake | find "Realtek PCIe GBE Family Controller" > nul if %ERRORLEVEL% neq 1 ( copy C:\ProgramData\my_scripts\dummy.txt C:\ProgramData\my_scripts\reboot-after-wol.txt GOTO EOF ) ELSE ( copy C:\ProgramData\my_scripts\dummy.txt C:\ProgramData\my_scripts\reboot-after-schedule.txt Start /D "C:\Program Files (x86)\DVBViewer" /B myActions.exe delayed-reboot GOTO EOF ) :EOF When booting the pc/windows , the following batch file is run (only when booting , not when resuming) to detect the boot cause. This is when updates are installed , or when I manually woken-up the pc to do some maintenance. In these cases the pc will be set in sleep mode. if exist C:\ProgramData\my_scripts\reboot-after-wol.txt ( ping 127.0.0.1 -w 1 del C:\ProgramData\my_scripts\reboot-after-wol.txt "C:\Program Files (x86)\DVBViewer\myExtendedExit.exe" Standby GOTO EOF ) if exist C:\ProgramData\my_scripts\reboot-after-schedule.txt ( del C:\ProgramData\my_scripts\reboot-after-schedule.txt ping 127.0.0.1 -w 1 "C:\Program Files (x86)\DVBViewer\myExtendedExit.exe" Standby GOTO EOF ) Somewhat difficult but it seems to be working as expected: 1- When the PC is woken-up by IR or power button : function normally 2- When the PC is woken-up by scheduled task : wait 30 minutes , and reboot (do not start DVBViewer , do not power-on tv) This is when windows updates are installed or other windows scheduled tasks. 3- When the PC is woken-up bij WOL : do not start DVBViewer , dont do anything. This is when I do remote maintenance. Quote Link to comment
nuts Posted April 5, 2016 Author Share Posted April 5, 2016 Puuuh that's not what I expected at all. Thanks for your test, but it will get hard to fix without a Win10 system. This will take some time sorry. Quote Link to comment
cuppie Posted April 5, 2016 Share Posted April 5, 2016 Nuts, no problem. I really have respect for your work , and the sharing of your knowledge. Quote Link to comment
cuppie Posted April 6, 2016 Share Posted April 6, 2016 Nuts, Last night I saw another issue. This time with sleeptimer.exe. When the timer is completed , There is no message at all. In my setup , the pc is set in standby without any message or warning. In older sleeptimer versions (not sure what version exactly) in the last minute was a warning , and possibility to stop the "shutdown action" Roel Quote Link to comment
nuts Posted April 7, 2016 Author Share Posted April 7, 2016 (edited) Nuts, Last night I saw another issue. This time with sleeptimer.exe. When the timer is completed , There is no message at all. In my setup , the pc is set in standby without any message or warning. In older sleeptimer versions (not sure what version exactly) in the last minute was a warning , and possibility to stop the "shutdown action" Ah ok. That's a bug ... Try this testbuild. I create another testbuild with more logging for powerbroadcast messages. Could you please repeate your test (wakeup by task and user input)? mySleeptimer.zip myExtendedExit.zip Edited April 7, 2016 by nuts Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.