text
stringlengths
0
15.7k
source
stringlengths
6
112
set thisSlideTitle to thisSectionText
lns3.scpt
set thisSlideBody to ""
lns3.scpt
else if paragraphCount is 2 then
lns3.scpt
set the masterSlideName to "Title & Subtitle"
lns3.scpt
set thisSlideTitle to the first paragraph of thisSectionText
lns3.scpt
set thisSlideBody to the second paragraph of thisSectionText
lns3.scpt
else if paragraphCount is greater than or equal to 3 then
lns3.scpt
set the masterSlideName to "Title & Bullets"
lns3.scpt
set thisSlideBodyElements to paragraphs 2 thru -1 of thisSectionText
lns3.scpt
set thisSlideBody to thisSlideBodyElements as string
lns3.scpt
my createSlide(masterSlideName, thisSlideTitle, thisSlideBody)
lns3.scpt
tell thisDocument to delete slide 1
lns3.scpt
start thisDocument from first slide of thisDocument
lns3.scpt
on createSlide(masterSlideName, thisSlideTitle, thisSlideBody)
lns3.scpt
set thisSlide to make new slide with properties {base slide:master slide masterSlideName}
lns3.scpt
tell thisSlide
lns3.scpt
set the transition properties to ¬
lns3.scpt
{transition effect:dissolve, transition duration:defaultTransitionDuration, transition delay:defaultTransitionDelay, automatic transition:defaultAutomaticTransition}
lns3.scpt
if title showing is true then
lns3.scpt
set the object text of the default title item to thisSlideTitle
lns3.scpt
if body showing is true then
lns3.scpt
set the object text of the default body item to thisSlideBody
lns3.scpt
end createSlide
lns3.scpt
property documentWidth : 1920
lns3.scpt
property documentHeight : 1080
lns3.scpt
property fourByThreeAspectWidth : (documentHeight * 4) / 3
lns3.scpt
property bufferThickness : 24
lns3.scpt
property captionTypeface : "Helvetica"
lns3.scpt
property captionTypeSize : 36
lns3.scpt
property captionTypeColor : {65535, 65535, 65535}
lns3.scpt
property defaultTransitionDuration : 2.0
lns3.scpt
property defaultTransitionDelay : 6.0
lns3.scpt
property placeholderText : "Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec ullamcorper nulla non metus auctor fringilla. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper."
lns3.scpt
set theseImageFiles to ¬
lns3.scpt
(choose file of type "public.image" with prompt ¬
lns3.scpt
"Choose the images to import:" default location ¬
lns3.scpt
(path to pictures folder) with multiple selections allowed)
lns3.scpt
display dialog "Enter the title for the presentation:" default answer ""
lns3.scpt
set the presentationTitle to the text returned of the result
lns3.scpt
if presentationTitle is not "" then exit repeat
lns3.scpt
display dialog "Enter the subtitle for the presentation:" default answer ""
lns3.scpt
set the presentationSubtitle to the text returned of the result
lns3.scpt
if presentationSubtitle is not "" then exit repeat
lns3.scpt
display dialog "Choose the caption type size:" buttons {"24", "36", "48"} default button 2
lns3.scpt
set the chosenCaptionTypeSize to (the button returned of the result) as integer
lns3.scpt
set thisDocument to make new document with properties ¬
lns3.scpt
{document theme:theme "Black", width:documentWidth, height:documentHeight}
lns3.scpt
set masterSlideForImage to master slide "Blank"
lns3.scpt
set masterSlideForTitle to master slide "Title & Subtitle"
lns3.scpt
set auto loop to true
lns3.scpt
tell slide 1
lns3.scpt
set base slide to masterSlideForTitle
lns3.scpt
set object text of default title item to presentationTitle
lns3.scpt
set object text of default body item to presentationSubtitle
lns3.scpt
{transition effect:doorway ¬ , transition duration:defaultTransitionDuration ¬ , transition delay:defaultTransitionDelay ¬ , automatic transition:defaultAutomaticTransition}
lns3.scpt
repeat with i from 1 to the count of theseImageFiles
lns3.scpt
set thisImageFile to item i of theseImageFiles
lns3.scpt
set thisImageCaption to my extractkMDItemDescription(thisImageFile)
lns3.scpt
if thisImageCaption is "" then set thisImageCaption to placeholderText
lns3.scpt
set the authorString to my extractkMDItemAuthors(thisImageFile, true)
lns3.scpt
if authorString is not "" then
lns3.scpt
set sidebarText to ¬
lns3.scpt
thisImageCaption & return & return & "Credit: " & authorString
lns3.scpt
set sidebarText to thisImageCaption
lns3.scpt
set thisSlide to make new slide with properties {base slide:masterSlideForImage}
lns3.scpt
set thisImage to make new image with properties {file:thisImageFile}
lns3.scpt
tell thisImage
lns3.scpt
set height to documentHeight
lns3.scpt
set thisWidth to width
lns3.scpt
if thisWidth is greater than fourByThreeAspectWidth then
lns3.scpt
set horizontalValue to ((thisWidth - fourByThreeAspectWidth) div 2) * -1
lns3.scpt
set position to {horizontalValue, 0}
lns3.scpt
set the captionBackground to make new shape with properties ¬
lns3.scpt
{width:documentWidth - fourByThreeAspectWidth ¬ , height:documentHeight ¬ , position:{fourByThreeAspectWidth, 0}}
lns3.scpt
set itemWidth to ¬
lns3.scpt
documentWidth - fourByThreeAspectWidth - bufferThickness - bufferThickness
lns3.scpt
set captionTextItem to ¬
lns3.scpt
make new text item with properties ¬
lns3.scpt
{width:itemWidth, object text:sidebarText}
lns3.scpt
tell captionTextItem
lns3.scpt
tell object text
lns3.scpt
set font to captionTypeface
lns3.scpt
set size to chosenCaptionTypeSize
lns3.scpt
set color of it to captionTypeColor
lns3.scpt
set position to {fourByThreeAspectWidth + bufferThickness, bufferThickness}
lns3.scpt
{transition effect:dissolve ¬ , transition duration:defaultTransitionDuration ¬ , transition delay:defaultTransitionDelay ¬ , automatic transition:defaultAutomaticTransition}
lns3.scpt
start thisDocument from slide 1 of thisDocument
lns3.scpt
on extractkMDItemDescription(thisImageFile)
lns3.scpt
set thisImagePOSIXPath to the POSIX path of thisImageFile
lns3.scpt
set the embeddedDescription to ¬
lns3.scpt
do shell script "mdls -name kMDItemDescription " & ¬
lns3.scpt
(quoted form of thisImagePOSIXPath)
lns3.scpt
if embeddedDescription is "kMDItemDescription = (null)" then
lns3.scpt
set embeddedDescription to ""
lns3.scpt
(text from ((length of "kMDItemDescription = \"") + 1) to ¬
lns3.scpt
-2 of embeddedDescription)
lns3.scpt
return embeddedDescription
lns3.scpt
end extractkMDItemDescription
lns3.scpt
on extractkMDItemAuthors(thisImageFile, returnAsString)
lns3.scpt
set the embeddedAuthorsList to ¬
lns3.scpt