JeffAllenNJ Posted October 22, 2012 Posted October 22, 2012 I was looking for a way to use AutoIt to register my EXE as an AutoPlay when I stick a DVD or BluRay in. I searched a bit but couldn't find anything, so I decided to write one. I'm posting it in in case ( a ) it can be improved or generalized and ( b ) someone else might like to use it. $script = StringSplit(@ScriptName,'.') $list = ProcessList(@ScriptName) If MsgBox(1,$script[1],'Register as AutoPlay Handler?') <> 1 Then Exit $keyname = 'HKEY_CURRENT_USER\Software\Classes\'&$script[1]&'.exe_autoplay_handler\shell\'&$script[1]&'_verb\command' RegWrite($keyname,'', 'REG_SZ', '"' & @ScriptFullPath & '" "%1"') $keyname = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\AutoplayHandlers\Handlers\'&$script[1]&'_using_'&$script[1]&'.exe' RegWrite($keyname, 'Action', 'REG_SZ', $script[1]) RegWrite($keyname, 'DefaultIcon', 'REG_SZ', @ScriptFullPath) RegWrite($keyname, 'InvokeProgID', 'REG_SZ', $script[1]&'.exe_autoplay_handler') RegWrite($keyname, 'InvokeVerb', 'REG_SZ', $script[1]&'_verb') RegWrite($keyname, 'Provider', 'REG_SZ', $script[1]&'.exe') $keyname = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\AutoplayHandlers\EventHandlers\' RegWrite($keyname & 'PlayDVDMovieOnArrival', $script[1]&'_using_'&$script[1]&'.exe', 'REG_SZ', '') RegWrite($keyname & 'PlayBluRayOnArrival', $script[1]&'_using_'&$script[1]&'.exe', 'REG_SZ', '') If MsgBox(1,$script[1],'Set as Default for DVDs and BluRay?') <> 1 Then Exit $keyname = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\' RegWrite($keyname & 'PlayDVDMovieOnArrival', $script[1]&'_using_'&$script[1]&'.exe', 'REG_SZ', '') RegWrite($keyname & 'PlayBluRayOnArrival', $script[1]&'_using_'&$script[1]&'.exe', 'REG_SZ', '')
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now