NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 22 23 24 25 26 … 93 Next »
XP: blocking suspend to run script:solution

 
  • 0 Vote(s) - 0 Average
XP: blocking suspend to run script:solution
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#1
2009-09-20, 03:42 PM (This post was last modified: 2009-10-31, 09:00 AM by pBS.)
1. Found a nice trick to force waiting for a shutdown or startup script using just gpedit.msc.
i haven't tested how long these cmds will wait,but they start before logon in startup and after desktop disappears on shutdown..
[EDIT: seems it does run scripts, but i can't get it to wait for recording completion..]

Startup/Shutdown Scripts:
1.) Start, Run, gpedit.msc
2.) Select Computer Configuration, Windows Settings, Scripts (Startup/Shutdown)
3.) Double Click Shutdown
4.) Click Add, and browse to the script.
5.) Click OK, and OK again.
6.) Close Group Policy.
7.) The script should now be run on shutdown.

it just adds an entry to
Code:
%windir%\system32\GroupPolicy\Machine\Scripts\scripts.ini
like:
[Shutdown]
0CmdLine=C:\test.exe
0Parameters=

but probably best to just use gpedit.msc...

2. Pause Suspend to Run Script

Anybody interested in a little util i wrote, that intercepts suspend, and runs script with as much time as you want, say to kill a problematic device with devcon, then continues suspend...upon resume, it can run another script/cmd...[to restart device,etc]

basically it just cancels the suspend completely, runs script/exe/whatever, then resumes suspend, not blocking it this time...Smile
Attached program pauses suspend request till a program or script is run, then suspends, and can optionally run another command upon resume...Big Grin

my script is still pretty rought but it works great..Smile
it doesn't intercept the 'suspend' from settings menu tho, Sad Sub forces the suspend....
use a normal suspend cmd to do it yourself from a custom menu item..
[i'll build in a suspend function later]
the second param is optional, but first one isn't..[cmd to run at suspend]

SuspDeny.exe "CmdToRunAtSuspend" "CmdToRunOnResume"-[Optional]
it runs invisibly...pause to exit..
run with no params to see help..
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#2
2009-09-26, 02:20 AM
i also just finished a util to pause any program, so i could pause comskip during heavy recording sessions [more than 3 hd streams at once]
it works with just about any program, and can be used from batch files..
[say you want to pause transcoding while epg update happens,etc..]

for programmers who want to use this function, it's a simple dll call:

pause:
Code:
$ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
resume:
Code:
$ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Script Helper Utility JavaWiz 2 2,326 2020-05-25, 11:00 AM
Last Post: Graham
  NSIS installer script for a NPVR plugin? McBainUK 6 3,221 2011-12-10, 03:23 PM
Last Post: mvallevand
  (Yet Another) Rename Helper script for GBPVR & NPVR pvruser 2 2,721 2011-07-22, 01:27 AM
Last Post: pvruser
  WinLIRC Telnet Changer Perl Script/Exe for IR Blasting hokiee 3 3,517 2011-02-20, 07:46 PM
Last Post: hokiee
  NPVR - temporary solution to lack of searchable fields after event is gone from guide carpeVideo 5 2,229 2010-09-29, 03:08 AM
Last Post: mvallevand
  GB-PVR XBMC Script jangeador 4 6,169 2008-05-31, 05:30 PM
Last Post: jangeador
  Batch File Script for Dummies (Me) dmorley00 0 1,815 2005-08-20, 10:36 PM
Last Post: dmorley00
  DVB - an interim solution? tellyaddict 0 1,701 2004-05-18, 10:43 AM
Last Post: tellyaddict

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode