Benches Apps and software

0

Save As Un-Editable (QuickTime)

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Could someone (more skilled than I) make changes to this droplet so that it works properly with Snow Leopard?

-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "GIFf", "TIFF"}
property type_list : {"MooV"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"mov"}
property fast_start : true

global temp_folder

repeat
display dialog "Save As Un-editable" & return & return & ¬
"This script will set the savable property of movie files to false, " & ¬
"thereby making them un-editable and un-saveable." & return & return & ¬
"WARNING: ONCE SET TO FALSE, THIS PROPERTY CANNOT BE CHANGED LATER." buttons {"Done"} default button 1
if the button returned of the result is "Done" then
exit repeat
end if
end repeat

-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
-- this routine uses the gestaltVersion_info() sub-routine
copy my gestaltVersion_info("qtim", 8) to {QT_version, QT_string}
if the QT_version is less than "0502" then
display dialog "This script requires QuickTime 5.0.2 or higher." & ¬
return & return & "The currently installed version is: " & ¬
QT_string buttons {"Cancel"} default button 1
end if
display dialog "Save As Un-editable" & return & return & ¬
"This script will set the savable property of movie files to false, " & ¬
"thereby making them un-editable and un-saveable." & return & return & ¬
"WARNING: ONCE SET TO FALSE, THIS PROPERTY CANNOT BE CHANGED." buttons {"Continue", "Cancel"} default button 2 with icon 2
-- create a unique temp folder
repeat
set this_name to (random number from 100000 to 999999) as string
tell application "Finder"
if not (exists folder this_name of the desktop) then
set the temp_folder to (make new folder at desktop with properties {name:this_name}) as alias
exit repeat
end if
end tell
end repeat
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if folder of the item_info is true then
processfolder(thisitem)
else if (alias of the item_info is false) and ¬
((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) then
processitem(thisitem)
end if
end repeat
-- delete the temp folder
tell application "Finder"
delete temp_folder
try
empty trash
end try
end tell
end open

-- this sub-routine processes folders
on processfolder(thisfolder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
processfolder(thisitem)
else if (alias of the item_info is false) and ¬
((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) then
processitem(thisitem)
end if
end repeat
end process_folder

-- this sub-routine processes files
on processitem(thisitem)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
tell application "QuickTime Player"
launch -- bypasses the promo movie
activate
my toggle_suppress(true)
stop every document
close every document saving no
try
open this_item
tell document 1
if «class sava» is false then
error "This movie has previously been set so that it cannot be copied, edited, or saved."
end if
«event MVWRrewi»
set «class sava» to false
end tell
close document 1 saving yes
my toggle_suppress(false)
on error error_msg number error_num
my toggle_suppress(false)
beep
display dialog error_msg with icon 1
try
close document 1 saving no
end try
end try
end tell
end process_item

on togglesuppress(statusflag)
tell application "QuickTime Player"
set «class iapl» to the status_flag
set «class iapr» to the status_flag
end tell
end toggle_suppress

on gestaltVersioninfo(gestaltcode, string_length)
try
tell application "Finder" to ¬
copy my NumToHex((system attribute gestalt_code), ¬
string_length) to {a, b, c, d}
set the numeric_version to {a, b, c, d} as string
if a is "0" then set a to ""
set the version_string to (a & b & "." & c & "." & d) as string
return {numeric_version, version_string}
on error
return {"", "unknown"}
end try
end gestaltVersion_info

on NumToHex(hexData, stringLength)
set hexString to {}
repeat with i from stringLength to 1 by -1
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
return (hexString as string)
end NumToHex

Thanks to all that take a look.

0 replies

Sign in or join Beachball Help to reply.