Command Line tool to run on start/standby/resume/shutdown etc... (1 Viewer)

dipunm

Portal Pro
August 6, 2006
68
1
38
After ALOT of jumping around, and installing meaningless programmes, slowing my pc down by the minute, i found (ON THIS FORUM!! :D YAY ) the info about command line tools for ir blaster

now, i think this prog works only for mce version blaster (the 1 that comes with the mce remote) but thats all i needed. Now, my main prob is that i can't get the batch file i made to run on windows resume and standby (can set it for startup and found a prog for shutdown) (i use it to turn my tv on/off and change av 4 times)

considering i will use mp to standby etc, i figured that mp should run tthese commands, but a command tool would allow for ANYTHING to be done on mp startup/shutdown/etc.

pls consider this
 

zombiepig

Portal Pro
March 21, 2005
408
0
Melb, Aus
Home Country
i agree - this would be a very handy feature. for what it's worth i was trying to do the same thing you are, sending a remote code on standby/resume, and ended up using a vb script i found through google. it kinda works... but it's pretty clunky and only allows me to send a single ir code before standby. If you'd like i can post the script when I'm back in front of my mp machine!
 

zombiepig

Portal Pro
March 21, 2005
408
0
Melb, Aus
Home Country
ok - put the following in a text file, named resume.vbs. then put a shortcut to the file in the startup group.

this script will run suspend.bat on suspend, and resume.bat on resume.
i'm using the mceirplay utility from http://burningzeroad.free.fr/MceIrApi.rar to playback recorded ir commands to switch on/off the tv and jump to the av input.

Code:
Set oShell = CreateObject("WScript.Shell")
Set colMonitoredEvents = GetObject("winmgmts:")._
       ExecNotificationQuery("Select * from Win32_PowerManagementEvent")

Do
   Set objLatestEvent = colMonitoredEvents.NextEvent

   Select Case objLatestEvent.EventType
     Case 4
oShell.Run "suspend.bat", 0, true
     Case 7
oShell.Run "resume.bat", 0, true
   End Select
Loop

(edit - this is really annoying - i edited the script to fix a character and now it's ignoring any new lines i'm putting in. if you hit quote to this post you should still be able to see it properly :mad:)

one catch is that suspend.bat has to be short. i can only send one ir command before the system suspends. that's why i'd ideally like to see an inbuilt mp option to run a command before suspend ;)
 

CHli

Portal Pro
July 5, 2005
1,251
14
Switzerland
Home Country
Switzerland Switzerland
thank you very much ! I'll give this a try tonight.

Edit : I think the first character of your script is missing ;)
 

dipunm

Portal Pro
August 6, 2006
68
1
38
Wow

Hey thanx for the quick reply, sorry i wast here to read it in time :p

Ive noticed you have a loop, do you have a description of how the script works?
I was thinking of putting a flag in the program ie. (wat for end) but not shure YET how to do this,. wen i find out ill post it (if its possible) also, thnx agen for input, i hope we can make it work ;)

ps. i used the same command line tool.

to use the command line tool

use 'MceIrRec -o <insert filename>' and then press the key on your remote (sat/tv remote) that does the function you want it to...
Do this in command prompt (goto run, type cmd then type cd <insert directory of folder where files are> then type the command above)

eg.
mceirrec -o onoff.irk

then to play, basically call MceIrPlay -i <insert filename> -b <insert port number:1 or 2>


eg.
mceirplay -i onoff.irk -b 1

finally, creating a batch file, open notepad and write each command on a separate line for each recording you want to play

eg.
mceirplay -i onoff.irk -b 1
sleep 1
mceirplay -i av.irk -b 1
sleep 1
mceirplay -i av.irk -b 1
sleep 1
mceirplay -i av.irk -b 1
sleep 1
mceirplay -i av.irk -b 1

save as <insert filename>.bat

this will turn on my tv and press av 4 times

make sure file type is set to any otherwise youll get <filename>.bat.txt and it wont run

sleep 1 is a command to make the batch file wait 1 second before continuing (http://www.computerhope.com/download/utility/sleep.exe)


IMPORTANT
All files must be in same directory
 

CHli

Portal Pro
July 5, 2005
1,251
14
Switzerland
Home Country
Switzerland Switzerland
Thanks EqualRightsForWerewolves I managed to get it working without problem with your vbscript.

Thanks to dipunm too.
 

dipunm

Portal Pro
August 6, 2006
68
1
38
theres only 1 thing i dont like about it... its running constantly in the background and its never idle

if i cant find another way ill use it, but i dont like that idea although windows probably dus the same thing at a huger scale :p
 

Users who are viewing this thread

Top Bottom