Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Jump to the beginning of a movie in DVD Player' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Jump to the beginning of a movie in DVD Player
Authored by: Safar on Jun 28, '04 06:12:31PM
whow ! i had posted this hint 2 or 3 months ago. anyway, i improved the script : this should be much better because it is protected against loops

tell application "DVD Player" to activate
my quickstart(72)

on quickstart(compteur)
	tell application "DVD Player"
		set time_elapsed to the elapsed time
		set title_length to the title length
		set good_time to (title_length - 1) as integer
		if (title_length < 1500) and (title_length > 7) then
			set elapsed time to good_time as integer
		end if
		set time_elapsed to elapsed time
		if (time_elapsed = compteur) then
			delay (time_elapsed + 1)
		end if
		if (title_length < 1500) then
			press enter key
			delay 1
			my quickstart(time_elapsed)
		end if
	end tell
end quickstart


[ Reply to This | # ]
Jump to the beginning of a movie in DVD Player
Authored by: Arif on Jun 28, '04 09:30:29PM

I've found Cameroon's version to by far be the most stable and best. I've made some simple changes, to start a dialog and ask whether you want to do it before you go ahead with doing it, this way, when you save as a run only application, and in your preferences set your newly made application to run whenever a video DVD is inserted, you can still have the choice to run as normal or cancel.

[code]

display dialog "Do you want to go straight to the film?" buttons {"Cancel", "No", "Yes"} default button {"Yes"}

if button returned of result = "Yes" then
tell application "DVD Player"
(* this won't work as desired if DVD Player is
already running when we get to this point
when given the series of commands this quickly
DVD Player will skip past all the unwanted crap and menus
that are becoming more common on DVDs.
This is perfect becuase then we don't have to come up
with some funky logic that may or may not play the movie
as expected *)
activate
try
set title to 1
on error
quit
end try
play dvd
end tell
else if button returned of result = "No" then
tell application "DVD Player"
activate
play dvd
end tell
else
tell current application
quit
end tell
end if

[/code]



[ Reply to This | # ]
Jump to the beginning of a movie in DVD Player
Authored by: Arif on Jun 28, '04 10:01:11PM

My apologies, I've already revised it. It is better to save it as a compiled script, select system preferences to open script when Video DVD inserted, with the following code:

[code]

display dialog "Do you want to go straight to the film?" buttons {"Cancel", "No", "Yes"} default button {"Yes"}
if button returned of result = "Yes" then
tell application "DVD Player"
(* this won't work as desired if DVD Player is
already running when we get to this point
when given the series of commands this quickly
DVD Player will skip past all the unwanted crap and menus
that are becoming more common on DVDs.
This is perfect becuase then we don't have to come up
with some funky logic that may or may not play the movie
as expected *)
activate
try
set title to 1
on error
quit
end try
play dvd
end tell
else if button returned of result = "No" then
tell application "DVD Player"
activate
play dvd
end tell
else if button returned of result = "Cancel" then
end if
end

[/code]



[ Reply to This | # ]
Jump to the beginning of a movie in DVD Player
Authored by: CompositionB on Mar 12, '05 01:31:26PM

Three questions about your code:

1. When I insert a DVD the dialog pops up, but is not active, so it takes two clicks to make a selection and pressing return doesn't work for "yes" (unless I click and then press it). I'm guessing this is just the lack of a keyword in the dialog command or one additional line of code to activate the dialog box, but with my limited scripting ability I couldn't tell you what's missing.

2. Why did you revise the final "else" to check for the cancel button instead of just exiting on anything other than a yes or no?

3. Why do you recommend saving the code as a compiled script? I have it saved as a normal script, and set to run when a DVD is inserted. It doesn't bring up the script editor, just runs like you'd expect. I see no benefit to saving it as an application and if I'm not mistaken doing so would make the script un-editable.



[ Reply to This | # ]