A valuable aspect of automation is its ability to save time. And while it is not overly difficult to open a Keynote presentation and export it to a movie file, sometimes it’s very useful to just drag a file onto an AppleScript droplet, have it do that for you, and notify you when it’s done!
DO THIS ►For your convenience, you can DOWNLOAD a completed version of the AppleScript droplet.
Here’s the droplet script. Open it in the AppleScript Editor and save it as an AppleScript application. You will then be able to drag Keynote presentation files onto the droplet.
-- TRIGGERED WHEN USER LAUNCHES DROPLET. PROMPT FOR PRESENTATION FILE(S):
05
settheseItemsto ¬
06
(choose fileof type "com.apple.iwork.keynote.key" with prompt ¬
07
"Pick the Keynote presentation(s) to export to movie:" withmultiple selections allowed )
08
opentheseItems
09
endrun
10
11
onopentheseItems
12
-- TRIGGERED WHEN USER DRAGS ITEMS ONTO THE DROPLET
13
display dialog "This droplet will export dragged-on Keynote presentation files as movies to the movies folder." & return & return & "The movies will be encoded to MPEG format using H.264 compression." with icon 1
14
set thefilesToProcessto {}
15
-- filter the dragged-on items for Keynote presentation files
16
repeat withifrom 1 to thecountoftheseItems
17
setthisItemto item ioftheseItems
18
if mycheckForIdentifier(thisItem, "com.apple.iwork.keynote.key") istruethen
19
set the end of thefilesToProcesstothisItem
20
end if
21
end repeat
22
iffilesToProcessis {} then
23
activate
24
display alert "INCOMPATIBLE ITEMS" message "None of the items were Keynote presentations."
25
else
26
-- process the presentations
27
myexportPresentationsToMovies(filesToProcess)
28
end if
29
endopen
30
31
oncheckForIdentifier(thisItem, thisIdentifier)
32
try
33
-- uses Spotlight to check for specified item type
34
set thequeryResultto ¬
35
(do shell script "mdls -name kMDItemContentType " & ¬
36
quoted formtoof thePOSIX pathtoofthisItem)
37
ifqueryResultcontains "(null)" then
38
returnfalse
39
else
40
setxto thelengthof "kMDItemContentType = \""
41
set theindentifierStringtotext (x + 1) thru -2 ofqueryResult
42
if theindentifierStringisthisIdentifierthen
43
returntrue
44
end if
45
end if
46
on error
47
returnfalse
48
end try
49
endcheckForIdentifier
50
51
onexportPresentationsToMovies(thesePresentations)
52
try
53
repeat withifrom 1 to the count ofthesePresentations
54
setthisPresentationto item iofthesePresentations
55
tellapplication "Keynote"
56
activate
57
ifplayingistruethen tell frontdocumenttostop
58
open thisPresentation
59
set thedocumentNametonameof the frontdocument
60
copy myderiveFileNameForNewFileInFolder(documentName, destinationFolder) to ¬
Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. MACOSXAUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. MACOSXAUTOMATION.COM provides this only as a convenience to our users. MACOSXAUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and MACOSXAUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from MACOSXAUTOMATION.COM and that MACOSXAUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.