text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set editableRowAreaHeight to editableAreaHeight - (rowGutterCount * rowGutterHeight)
|
lns3.scpt
|
set shapeWidth to editableColumnAreaWidth div columnCount
|
lns3.scpt
|
set shapeHeight to editableRowAreaHeight div rowCount
|
lns3.scpt
|
set targetImageFilePath to the POSIX path of (path to pictures folder) & "placeholder.jpg"
|
lns3.scpt
|
my createCustomPlaceholderImageFile(shapeWidth, shapeHeight, targetImageFilePath, false)
|
lns3.scpt
|
set targetImageFile to targetImageFilePath as POSIX file
|
lns3.scpt
|
tell current page
|
lns3.scpt
|
set thisHorizontalOffset to leftMarginWidth
|
lns3.scpt
|
set thisVerticalOffset to topMarginHeight
|
lns3.scpt
|
set itemCounter to 0
|
lns3.scpt
|
set textItemCount to 0
|
lns3.scpt
|
set imageItemCount to 0
|
lns3.scpt
|
repeat with i from 1 to rowCount
|
lns3.scpt
|
repeat with q from 1 to columnCount
|
lns3.scpt
|
if the objectType is "Images" then
|
lns3.scpt
|
set itemCounter to itemCounter + 1
|
lns3.scpt
|
set placeholderText to "PLACEHOLDER-" & (itemCounter as text)
|
lns3.scpt
|
set thisImage to make new image with properties {file:targetImageFile, width:shapeWidth, height:shapeHeight, position:{thisHorizontalOffset, thisVerticalOffset}, description:placeholderText}
|
lns3.scpt
|
tell application "System Events" to keystroke "i" using {control down, command down, option down}
|
lns3.scpt
|
else if the objectType is "Text Items" then
|
lns3.scpt
|
if shouldAddID is true then
|
lns3.scpt
|
set placeholderText to ""
|
lns3.scpt
|
make new text item with properties {width:shapeWidth, height:shapeHeight, position:{thisHorizontalOffset, thisVerticalOffset}, object text:placeholderText}
|
lns3.scpt
|
else if the objectType is "Both" then
|
lns3.scpt
|
if i mod 2 is 0 then -- even row is text items
|
lns3.scpt
|
set textItemCount to textItemCount + 1
|
lns3.scpt
|
set placeholderText to "TEXT-" & textItemCount as text
|
lns3.scpt
|
else -- odd row is images
|
lns3.scpt
|
set imageItemCount to imageItemCount + 1
|
lns3.scpt
|
set placeholderText to "IMAGE-" & imageItemCount as text
|
lns3.scpt
|
if shouldAddID is true then set description of thisImage to placeholderText
|
lns3.scpt
|
set thisHorizontalOffset to thisHorizontalOffset + columnGutterWidth + shapeWidth
|
lns3.scpt
|
set thisVerticalOffset to thisVerticalOffset + rowGutterHeight + shapeHeight
|
lns3.scpt
|
tell application id "com.apple.Finder" to move targetImageFile to the trash
|
lns3.scpt
|
on promptForIntegerValue(thisPrompt, minimumValue, maximumValue, defaultValue)
|
lns3.scpt
|
display dialog thisPrompt default answer (defaultValue as string)
|
lns3.scpt
|
set thisValue to (the text returned of the result) as integer
|
lns3.scpt
|
if thisValue is greater than or equal to minimumValue and thisValue is less than or equal to maximumValue then
|
lns3.scpt
|
return thisValue
|
lns3.scpt
|
end promptForIntegerValue
|
lns3.scpt
|
on indexOfItemInList(aValue, theList)
|
lns3.scpt
|
set theIndex to theArray's indexOfObject:aValue
|
lns3.scpt
|
return (theIndex + 1)
|
lns3.scpt
|
end indexOfItemInList
|
lns3.scpt
|
on createCustomPlaceholderImageFile(aWidth, aHeight, targetImageFilePath, shouldReveal)
|
lns3.scpt
|
set aColor to current application's NSColor's grayColor
|
lns3.scpt
|
set aSize to {width:aWidth, height:aHeight}
|
lns3.scpt
|
set aRect to current application's NSMakeRect(0, 0, aWidth, aHeight)
|
lns3.scpt
|
set aImage to current application's NSImage's alloc()'s initWithSize:aSize
|
lns3.scpt
|
aImage's lockFocus()
|
lns3.scpt
|
aColor's drawSwatchInRect:aRect
|
lns3.scpt
|
aImage's unlockFocus()
|
lns3.scpt
|
set aResult to writeNSImageObjectToFileAsJPEG(aImage, targetImageFilePath, shouldReveal)
|
lns3.scpt
|
return aResult
|
lns3.scpt
|
end createCustomPlaceholderImageFile
|
lns3.scpt
|
on writeNSImageObjectToFileAsJPEG(thisImageObject, targetImageFilePath, shouldRevealInFinder)
|
lns3.scpt
|
set tiffData to thisImageObject's TIFFRepresentation()
|
lns3.scpt
|
set imageRep to current application's NSBitmapImageRep's imageRepWithData:tiffData
|
lns3.scpt
|
set theProps to current application's NSDictionary's dictionaryWithObject:1.0 forKey:(current application's NSImageCompressionFactor)
|
lns3.scpt
|
set imageData to (imageRep's representationUsingType:(current application's NSJPEGFileType) |properties|:theProps)
|
lns3.scpt
|
set theResult to (imageData's writeToFile:targetImageFilePath atomically:true |error|:(missing value)) as boolean
|
lns3.scpt
|
if theResult is true then
|
lns3.scpt
|
if shouldRevealInFinder is true then
|
lns3.scpt
|
set theseURLs to {}
|
lns3.scpt
|
set the end of theseURLs to (current application's NSURL's fileURLWithPath:targetImageFilePath)
|
lns3.scpt
|
tell current application's NSWorkspace to set theWorkspace to sharedWorkspace()
|
lns3.scpt
|
tell theWorkspace to activateFileViewerSelectingURLs:theseURLs
|
lns3.scpt
|
error "There was a problem writing the image object to file."
|
lns3.scpt
|
end writeNSImageObjectToFileAsJPEG
|
lns3.scpt
|
property defaultTransitionDuration : 0.5
|
lns3.scpt
|
property defaultTransitionDelay : 2.0
|
lns3.scpt
|
property defaultAutomaticTransition : true
|
lns3.scpt
|
set dialogParagraphBreak to return & return
|
lns3.scpt
|
display dialog "This script will create a new Keynote document based on the content of the frontmost OmniOutliner document." & dialogParagraphBreak & "Each section head of the OmniOutliner document will be used as the title for a new slide in the Keynote document." & dialogParagraphBreak & "If a section contains no children, the “Title - Center” master will be used." & dialogParagraphBreak & "If a section contains one child, the “Title & Subtitle” master will be used, with the name of the child becoming the subtitle." & dialogParagraphBreak & "If a section contains more than one child, the “Title & Bullets” master will be used, and the section’s children will become the bullet points for the created slide." & dialogParagraphBreak & "The new slideshow will automatically play from the beginning and auto-advance." with icon 1
|
lns3.scpt
|
set the slideCount to the count of sections
|
lns3.scpt
|
set the themeNames to the name of every theme
|
lns3.scpt
|
set the chosenTheme to ¬
|
lns3.scpt
|
(choose from list themeNames with prompt ¬
|
lns3.scpt
|
"Choose a theme to use:" default items (item 1 of themeNames))
|
lns3.scpt
|
if chosenTheme is false then error number -128
|
lns3.scpt
|
set dialogMessage to "Standard Size or Widescreen?"
|
lns3.scpt
|
display dialog dialogMessage buttons {"Cancel", "Standard", "Widescreen"} default button 3
|
lns3.scpt
|
if the button returned of the result is "Standard" then
|
lns3.scpt
|
set targetWidth to 1024 -- 1440 <-- higher resolution
|
lns3.scpt
|
set targetHeight to 768 -- 1080 <-- higher resolution
|
lns3.scpt
|
set targetWidth to 1920
|
lns3.scpt
|
set targetHeight to 1080
|
lns3.scpt
|
{document theme:theme (chosenTheme as string), width:targetWidth, height:targetHeight}
|
lns3.scpt
|
repeat with i from 1 to the count of sections
|
lns3.scpt
|
set thisSectionText to name of it
|
lns3.scpt
|
repeat with q from 1 to the count of children
|
lns3.scpt
|
tell child q
|
lns3.scpt
|
set thisSectionText to thisSectionText & return & name of it
|
lns3.scpt
|
set the childCount to the count of children
|
lns3.scpt
|
if the childCount is not 0 then
|
lns3.scpt
|
repeat with z from 1 to the childCount
|
lns3.scpt
|
set thisSectionText to thisSectionText & return & tab & name of child z
|
lns3.scpt
|
set the paragraphCount to the count of paragraphs of thisSectionText
|
lns3.scpt
|
if paragraphCount is 1 then
|
lns3.scpt
|
set the masterSlideName to "Title - Center"
|
lns3.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.