text
stringlengths
0
15.7k
source
stringlengths
6
112
do shell script "mdls -name kMDItemAuthors " & ¬
lns3.scpt
if embeddedAuthorsList is "kMDItemAuthors = (null)" then
lns3.scpt
if returnAsString is true then
lns3.scpt
set the authorList to ¬
lns3.scpt
(text from ((length of "kMDItemAuthors = \"") + 2) ¬
lns3.scpt
to -3 of embeddedAuthorsList)
lns3.scpt
set the authorList to every paragraph of authorList
lns3.scpt
set cleanedList to {}
lns3.scpt
repeat with i from 1 to the count of authorList
lns3.scpt
set thisAuthor to item i of authorList
lns3.scpt
set x to the offset of "\"" in thisAuthor
lns3.scpt
set thisAuthor to text from (x + 1) to -1 of thisAuthor
lns3.scpt
if thisAuthor ends with "\"" then ¬
lns3.scpt
set thisAuthor to text 1 thru -2 of thisAuthor
lns3.scpt
set the end of cleanedList to thisAuthor
lns3.scpt
set the authorCount to the count of cleanedList
lns3.scpt
if authorCount is 1 then return (cleanedList as string)
lns3.scpt
set the authorString to cleanedList as string
lns3.scpt
return cleanedList
lns3.scpt
end extractkMDItemAuthors
lns3.scpt
property transitionInOutDuration : 3
lns3.scpt
property transitionPanDuration : 10
lns3.scpt
property transitionInOutDelay : 2
lns3.scpt
set the sourcePanoImage to ¬
lns3.scpt
"Pick the panoramic image to place across two slides:")
lns3.scpt
{document theme:theme "Black", width:1920, height:1080}
lns3.scpt
set documentHeight to its height
lns3.scpt
set documentWidth to its width
lns3.scpt
set the base slide of slide 1 to master slide "Blank"
lns3.scpt
{transition effect:magic move ¬ , transition duration:transitionInOutDuration ¬ , transition delay:transitionInOutDelay ¬ , automatic transition:true}
lns3.scpt
set thisImage to ¬
lns3.scpt
make new image with properties {file:sourcePanoImage}
lns3.scpt
set secondSlide to ¬
lns3.scpt
make new slide with properties {base slide:master slide "Blank"}
lns3.scpt
tell secondSlide
lns3.scpt
{transition effect:magic move ¬ , transition duration:transitionPanDuration ¬ , transition delay:0 ¬ , automatic transition:true}
lns3.scpt
set thirdSlide to ¬
lns3.scpt
tell thirdSlide
lns3.scpt
set imageWidth to its width
lns3.scpt
set position to {documentWidth - imageWidth, 0}
lns3.scpt
set fourthSlide to ¬
lns3.scpt
tell fourthSlide
lns3.scpt
property destinationFolder : (path to movies folder)
lns3.scpt
set theseItems to ¬
lns3.scpt
(choose file of type "com.apple.iwork.keynote.key" with prompt ¬
lns3.scpt
"Pick the Keynote presentation(s) to export to movie:" with multiple selections allowed)
lns3.scpt
open theseItems
lns3.scpt
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
lns3.scpt
set the filesToProcess to {}
lns3.scpt
repeat with i from 1 to the count of theseItems
lns3.scpt
set thisItem to item i of theseItems
lns3.scpt
if my checkForIdentifier(thisItem, "com.apple.iwork.keynote.key") is true then
lns3.scpt
set the end of the filesToProcess to thisItem
lns3.scpt
if filesToProcess is {} then
lns3.scpt
display alert "INCOMPATIBLE ITEMS" message "None of the items were Keynote presentations."
lns3.scpt
my exportPresentationsToMovies(filesToProcess)
lns3.scpt
on checkForIdentifier(thisItem, thisIdentifier)
lns3.scpt
set the queryResult to ¬
lns3.scpt
(do shell script "mdls -name kMDItemContentType " & ¬
lns3.scpt
quoted form of the POSIX path of thisItem)
lns3.scpt
if queryResult contains "(null)" then
lns3.scpt
set x to the length of "kMDItemContentType = \""
lns3.scpt
set the indentifierString to text (x + 1) thru -2 of queryResult
lns3.scpt
if the indentifierString is thisIdentifier then
lns3.scpt
end checkForIdentifier
lns3.scpt
on exportPresentationsToMovies(thesePresentations)
lns3.scpt
repeat with i from 1 to the count of thesePresentations
lns3.scpt
set thisPresentation to item i of thesePresentations
lns3.scpt
if playing is true then tell front document to stop
lns3.scpt
open thisPresentation
lns3.scpt
set the documentName to name of the front document
lns3.scpt
copy my deriveFileNameForNewFileInFolder(documentName, destinationFolder) to ¬
lns3.scpt
{targetName, targetPOSIXpath}
lns3.scpt
set destinationFile to (targetPOSIXpath as POSIX file)
lns3.scpt
with timeout of 1200 seconds -- 20 minutes
lns3.scpt
export front document to destinationFile ¬
lns3.scpt
as QuickTime movie with properties {movie format:large}
lns3.scpt
close front document saving no
lns3.scpt
display notification documentName with title "Keynote Movie Export"
lns3.scpt
display alert "EXPORT ERROR" message errorMessage
lns3.scpt
end exportPresentationsToMovies
lns3.scpt
on deriveFileNameForNewFileInFolder(sourceItemBaseName, targetFolderHFSAlias)
lns3.scpt
set targetFolderPOSIXPath to (POSIX path of targetFolderHFSAlias)
lns3.scpt
set incrementSeparator to "-"
lns3.scpt
set targetExtension to "m4v"
lns3.scpt
set extensionSeparator to "."
lns3.scpt
set targetName to sourceItemBaseName & extensionSeparator & targetExtension
lns3.scpt
set targetItemPOSIXPath to targetFolderPOSIXPath & targetName
lns3.scpt
set the fileExistenceStatus to ¬
lns3.scpt
(do shell script "[ -a " & (quoted form of targetItemPOSIXPath) & ¬
lns3.scpt
" ] && echo 'true' || echo 'false'") as boolean
lns3.scpt
if fileExistenceStatus is true then
lns3.scpt
set the nameIncrement to 1
lns3.scpt
set the newName to ¬
lns3.scpt
(the sourceItemBaseName & incrementSeparator & ¬
lns3.scpt
(nameIncrement as Unicode text) & ¬
lns3.scpt
extensionSeparator & targetExtension) as Unicode text
lns3.scpt
set targetItemPOSIXPath to targetFolderPOSIXPath & newName
lns3.scpt
set the nameIncrement to the nameIncrement + 1
lns3.scpt
set the targetPOSIXpath to (targetFolderPOSIXPath & newName)
lns3.scpt