AppleScript won't compile (?)
Richard Gaskin
ambassador at fourthworld.com
Thu Aug 19 23:02:26 EDT 2004
Pasted below is an AppleScript I found at
<http://www.apple.com/applescript/quicktime/> to obtain info about
chapter tracks in movies.
While I can paste it and run it fine in AppleScript Editor, putting it
into a field and using:
do fld 1 as AppleScript
...generates an error: "compiler error" (not very helpful)
So my question is:
What could be causing the script to run well in AppleScript
Editor but not using Rev's "do" command?
TIA -
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
--------------- the script in question -----------
tell application "QuickTime Player"
launch
activate
try
if not (exists movie 1) then error "No movies are open."
stop every movie
-- CHECK FOR THE CORRECT VERSION
set QT_version to (QuickTime version as string)
set player_version to (version as string)
if (QT_version is less than "5.0") or ¬
(player_version is less than "5.0") then
error "This script requires QuickTime 5.0 or greater." & ¬
return & return & ¬
"Current QuickTime Version: " & QT_version & return & ¬
"Current QuickTime Player Version: " & player_version
end if
-- CHECK FOR QUICKTIME PRO
if QuickTime Pro installed is false then
set the target_URL to "http://www.apple.com/quicktime/download/"
display dialog "This script requires QuickTime Pro." & return &
return & ¬
"If this computer is currently connected to the Internet, " & ¬
"click the Upgrade
button to visit the QuickTime Website at:" & ¬
return & return & target_URL buttons {"Upgrade", "Cancel"} default
button 2
ignoring application responses
tell application "Finder"
open location target_URL
end tell
end ignoring
error number -128
end if
tell movie 1
if the (count of chapters) is not 0 then
set this_track to the current chapter track
set the chapter_names to the name of every chapter of this_track
set the chapter_times to the time of every chapter of this_track
set the chapter_durations to the duration of every chapter of this_track
set the chapter_infolist to {}
repeat with i from 1 to the count of the the chapter_names
set the end of the chapter_infolist to ¬
(item i of chapter_names & " " & item i of chapter_times & "
" & item i of chapter_durations)
end repeat
choose from list chapter_infolist with prompt ("Chapter Summary" &
return & "Name " Start " Duration") cancel button name " " with empty
selection allowed
else
error "The front movie has no chapters."
end if
end tell
on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Cancel"} default button 1
end if
end try
end tell
-------------------------------------------------
More information about the use-livecode
mailing list