| View previous topic :: View next topic |
| Author |
Message |
geoff
Joined: 16 Nov 2006 Posts: 10
|
Posted: Sun Dec 17, 2006 9:12 pm Post subject: Customised Autorun? |
|
|
Hello all,
I am wondering if this is possible.
I want a script that will detect when a CD is inserted into the drive, and once it detects, automatically run a command line parameter (in this case, I want it to automatically copy the whole CD to the HD). The script sleeps until I eject the CD and put a new one in and then it repeats the process.
Is this possible? |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 350
|
Posted: Sun Dec 17, 2006 9:55 pm Post subject: |
|
|
Here is a starting point for you-
| Code: | OnMessage(0x219, "notify_change")
Return
notify_change(wParam, lParam, msg, hwnd)
{
;MsgBox, %wParam% %lParam% %msg% %hwnd%
if wParam = 32768
msgbox, CD Inserted
} |
It displays a message box when a CD is inserted. |
|
| Back to top |
|
 |
geoff
Joined: 16 Nov 2006 Posts: 10
|
Posted: Tue Dec 19, 2006 2:19 am Post subject: |
|
|
Thank you, but for some reason this script does nothing on my laptop.
Any ideas? |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 350
|
Posted: Tue Dec 19, 2006 2:34 am Post subject: |
|
|
| salvius wrote: | Thank you, but for some reason this script does nothing on my laptop.
Any ideas? |
I tried it on several computers and the only time it never worked was on a DVD drive (although I'm not sure if the drive was functioning correctly).
Try un-commenting the MsgBox line and then when you put a CD in check what the wParam is. Then change the IF statement accordingly. |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 350
|
Posted: Tue Dec 19, 2006 12:07 pm Post subject: |
|
|
If you are still having trouble, here is another method-
| Code: | detect:
DriveGet, FS, FileSystem, D:
If FS = CDFS ;If the FileSystem of the D Drive is that of a CD
{
msgbox, CD In Drive
}
loop
{
DriveGet, FS, FileSystem, D:
If FS = CDFS
sleep, 5000
else
{
sleep, 5000
goto, detect
}
}
|
It is a modification of theCD autorun script that I wrote ages ago. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7184
|
Posted: Tue Dec 19, 2006 12:33 pm Post subject: |
|
|
| Jon wrote: | | I tried it on several computers and the only time it never worked was on a DVD drive (although I'm not sure if the drive was functioning correctly). |
FYI: Your code works fine with my DVD-Writer -> detects DVD / CD
 _________________ Suresh Kumar A N |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3906 Location: Bremen, Germany
|
Posted: Thu Apr 19, 2007 11:47 pm Post subject: |
|
|
Jons script works on my laptop with a DVD Writer too.
How can I get the drive letter from the Message parameters? | Quote: | CD Inserted
wParam := 32768
lParam := 8977408
msg := 0x219
hwnd := 0x40652 | The message 0x219 is actually WM_DEVICECHANGE _________________ Ciao
toralf  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7184
|
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3906 Location: Bremen, Germany
|
Posted: Fri Apr 20, 2007 11:10 am Post subject: |
|
|
Thanks a lot Skan. Absolutely what I was looking for. Should have done a search, sorry. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
openextremeconsole
Joined: 20 Oct 2008 Posts: 7 Location: Illinois
|
Posted: Mon Oct 20, 2008 8:08 pm Post subject: Thank you |
|
|
This is what I was looking for.
Only instead of messaging me that there is a CD in the drive, I'll modify it to launch another script, one that checks if the disc in the drive is a game in my database. If it is AND it's uninstalled, then it will launch a script that auto-installs the game and then launches it. If it IS already installed, it just launches the game. And now the PC acts like a console.
Couple this functionality with a media center and a PVR, and I have the ultimate HTPC, including PC gaming at the insertion of a disc.
openextreme.crashandthefury.com
Any of you brilliant coders want a challenge, head over there, see what we're up to, and post in the forums any ideas you have to make things more efficient or even to add functionality I haven't thought of yet.
BTW, the message box DOES come up, but so does an explorer window to show me the files on the disc. Anyway to suppress than in XP SP2? _________________ openextreme.crashandthefury.com |
|
| Back to top |
|
 |
|