MideanTsukasa
04-20-2007, 02:33 PM
ok.....
I was putting together advertising for websites to be added to our DVD for our magazine. We wanted to make the program as "dummy proofed" as possible.
so we wanted a button that took you from the auto run file and opened up the default software.
Now I did find some snip-its of code for doing this under version 4.0. Now I ran up against rewriting the code.
For your pleasure here is the new version of that code as i finished slapping it together
I'm sure some of you scripting junkies can easily come up with a more robust but equally effective script.
Refine the script below as you need and past in your post if you want.
--Get the software info from the registery
DVDKEY = Registry.GetValue(HKEY_CLASSES_ROOT, "DVD\\shell", "", true);
DVDPATH = Registry.GetValue(HKEY_CLASSES_ROOT, "DVD\\shell\\"..DVDKEY.."\\command", "", true);
--Change the source drive
DVDPATH = String.Replace(DVDPATH, "%L", _SourceDrive, false);
DVDPATH = String.Replace(DVDPATH, "%1", _SourceDrive, false);
--Split the DVDPATH string and ready it for running
ENDOFDVDSOFTWARE = String.Find(DVDPATH, "\" ", 1, false);
RIGHTSIDEARGUMENTS = String.Length(DVDPATH);
RIGHTSIDEARGUMENTS = RIGHTSIDEARGUMENTS - ENDOFDVDSOFTWARE;
DVDPROGRAM = String.Left(DVDPATH, ENDOFDVDSOFTWARE);
ARGUMENTS = String.Right(DVDPATH, RIGHTSIDEARGUMENTS);
ARGUMENTS = String.Replace(ARGUMENTS, "\"", "", false);
ENDOFDVDSOFTWARE = ENDOFDVDSOFTWARE - 1;
DVDPROGRAM = String.Left(DVDPROGRAM, ENDOFDVDSOFTWARE);
ENDOFDVDSOFTWARE = ENDOFDVDSOFTWARE - 1;
DVDPROGRAM = String.Right(DVDPROGRAM, ENDOFDVDSOFTWARE);
ARGUMENTSLENGTH = String.Length(ARGUMENTS);
ARGUMENTSLENGTH = ARGUMENTSLENGTH - 1;
ARGUMENTS = String.Right(ARGUMENTS, ARGUMENTSLENGTH);
--test code for testing contents of the strings
--Result = Dialog.Message("Title", "DVDKEY = "..DVDKEY.." DVDPATH ="..DVDPATH, Ok, Question)
--Result = Dialog.Message("Title", "DVDPROGRAM"..DVDPROGRAM, Ok, Question)
--Result = Dialog.Message("Title", "ARGUMENTS"..ARGUMENTS, Ok, Question)
--If there is no software installed it will error out
if ((DVDKEY == "") or (DVDKEY == "\"\"") or (DVDPATH == "") or (DVDPATH == "\"\""))
then
Result = Dialog.Message("Could not find DVD Player Program", "This computer does not have DVD video software loaded.", Ok, MB_ICONEXCLAMATION);
--If there is software installed it will start the DVD software and shut down the auto run pages
else
result = File.Run(DVDPROGRAM, ARGUMENTS, "", SW_MAXIMIZE, false);
Application.Exit();
end
For use in the scripting on version 6.0
I was putting together advertising for websites to be added to our DVD for our magazine. We wanted to make the program as "dummy proofed" as possible.
so we wanted a button that took you from the auto run file and opened up the default software.
Now I did find some snip-its of code for doing this under version 4.0. Now I ran up against rewriting the code.
For your pleasure here is the new version of that code as i finished slapping it together
I'm sure some of you scripting junkies can easily come up with a more robust but equally effective script.
Refine the script below as you need and past in your post if you want.
--Get the software info from the registery
DVDKEY = Registry.GetValue(HKEY_CLASSES_ROOT, "DVD\\shell", "", true);
DVDPATH = Registry.GetValue(HKEY_CLASSES_ROOT, "DVD\\shell\\"..DVDKEY.."\\command", "", true);
--Change the source drive
DVDPATH = String.Replace(DVDPATH, "%L", _SourceDrive, false);
DVDPATH = String.Replace(DVDPATH, "%1", _SourceDrive, false);
--Split the DVDPATH string and ready it for running
ENDOFDVDSOFTWARE = String.Find(DVDPATH, "\" ", 1, false);
RIGHTSIDEARGUMENTS = String.Length(DVDPATH);
RIGHTSIDEARGUMENTS = RIGHTSIDEARGUMENTS - ENDOFDVDSOFTWARE;
DVDPROGRAM = String.Left(DVDPATH, ENDOFDVDSOFTWARE);
ARGUMENTS = String.Right(DVDPATH, RIGHTSIDEARGUMENTS);
ARGUMENTS = String.Replace(ARGUMENTS, "\"", "", false);
ENDOFDVDSOFTWARE = ENDOFDVDSOFTWARE - 1;
DVDPROGRAM = String.Left(DVDPROGRAM, ENDOFDVDSOFTWARE);
ENDOFDVDSOFTWARE = ENDOFDVDSOFTWARE - 1;
DVDPROGRAM = String.Right(DVDPROGRAM, ENDOFDVDSOFTWARE);
ARGUMENTSLENGTH = String.Length(ARGUMENTS);
ARGUMENTSLENGTH = ARGUMENTSLENGTH - 1;
ARGUMENTS = String.Right(ARGUMENTS, ARGUMENTSLENGTH);
--test code for testing contents of the strings
--Result = Dialog.Message("Title", "DVDKEY = "..DVDKEY.." DVDPATH ="..DVDPATH, Ok, Question)
--Result = Dialog.Message("Title", "DVDPROGRAM"..DVDPROGRAM, Ok, Question)
--Result = Dialog.Message("Title", "ARGUMENTS"..ARGUMENTS, Ok, Question)
--If there is no software installed it will error out
if ((DVDKEY == "") or (DVDKEY == "\"\"") or (DVDPATH == "") or (DVDPATH == "\"\""))
then
Result = Dialog.Message("Could not find DVD Player Program", "This computer does not have DVD video software loaded.", Ok, MB_ICONEXCLAMATION);
--If there is software installed it will start the DVD software and shut down the auto run pages
else
result = File.Run(DVDPROGRAM, ARGUMENTS, "", SW_MAXIMIZE, false);
Application.Exit();
end
For use in the scripting on version 6.0