text
stringlengths
0
15.7k
source
stringlengths
6
112
display dialog "Count is now " & currentCount & "."
lns3.scpt
set currentCount to 0
lns3.scpt
increment() --result: 1
lns3.scpt
increment() --result: 2
lns3.scpt
property currentCount : 0
lns3.scpt
script Paula
lns3.scpt
property currentCount : 20
lns3.scpt
script Joe
lns3.scpt
return currentCount
lns3.scpt
tell Joe to increment()
lns3.scpt
run Paula --result: 1
lns3.scpt
run Paula --result: 2
lns3.scpt
currentCount --result: 2
lns3.scpt
currentCount of Paula --result: 20
lns3.scpt
script John
lns3.scpt
property HowManyTimes : 0
lns3.scpt
to sayHello to someone
lns3.scpt
set HowManyTimes to HowManyTimes + 1
lns3.scpt
return "Hello " & someone
lns3.scpt
end sayHello
lns3.scpt
tell John to sayHello to "Herb" --result: "Hello Herb"
lns3.scpt
on makePoint(x, y)
lns3.scpt
script thePoint
lns3.scpt
property xCoordinate:x
lns3.scpt
property yCoordinate:y
lns3.scpt
return thePoint
lns3.scpt
end makePoint
lns3.scpt
set myPoint to makePoint(10,20)
lns3.scpt
get xCoordinate of myPoint --result: 10
lns3.scpt
get yCoordinate of myPoint --result: 20
lns3.scpt
property defaultTemplateName : "Blank"
lns3.scpt
property defaultDocumentTitleTypeSize : 32
lns3.scpt
property defaultDocumentTitleTypeFace : "Hoefler Text"
lns3.scpt
property defaultDocumentTitleTypeColor : "black"
lns3.scpt
property defaultSectionTypeFace : "Times New Roman Italic"
lns3.scpt
property defaultSectionTypeSize : 18
lns3.scpt
property defaultSectionTypeColor : "black"
lns3.scpt
property defaultBodyTypeFace : "Hoefler Text"
lns3.scpt
property defaultBodyTypeSize : 12
lns3.scpt
property defaultBodyTypeColor : "gray"
lns3.scpt
property defaultTOCTitleTypeFace : "Helvetica"
lns3.scpt
property defaultTOCTitleTypeSize : 22
lns3.scpt
property defaultTOCTitleTypeColor : "black"
lns3.scpt
property defaultTOCItemTypeFace : "Hoefler Text"
lns3.scpt
property defaultTOCItemTypeSize : 18
lns3.scpt
property defaultTOCItemTypeColor : "gray"
lns3.scpt
property useSectionTitleForTOC : true
lns3.scpt
display dialog "This script will create a new Pages word-processing document, with each section of the frontmost OmniOutliner document becoming a new section in the Pages document." & return & return & "The name of each OmniOutliner section will be used as both the title of the newly created Pages section, and as an entry in the optionally created Table of Contents." with icon 1 buttons {"Cancel", "Include TOC", "Build"} default button 3
lns3.scpt
if button returned of the result is "Include TOC" then
lns3.scpt
set createTOC to true
lns3.scpt
set createTOC to false
lns3.scpt
set sourceDocumentTitle to its name
lns3.scpt
set the sourceDocumentSectionNames to the name of every section
lns3.scpt
set the sourceDocumentSectionCount to ¬
lns3.scpt
the count of the sourceDocumentSectionNames
lns3.scpt
set thisDocument to ¬
lns3.scpt
make new document with properties ¬
lns3.scpt
{document template:template defaultTemplateName}
lns3.scpt
tell thisDocument
lns3.scpt
if document body is false then
lns3.scpt
display alert "INCOMPATIBLE TEMPLATE" message "The template of this document does not have an active document body text flow."
lns3.scpt
tell page 1
lns3.scpt
set body text to sourceDocumentTitle
lns3.scpt
tell body text
lns3.scpt
set font to defaultDocumentTitleTypeFace
lns3.scpt
set size to defaultDocumentTitleTypeSize
lns3.scpt
set the color of it to defaultDocumentTitleTypeColor
lns3.scpt
if createTOC is true then
lns3.scpt
make new section
lns3.scpt
set bufferIndex to 2
lns3.scpt
set bufferIndex to 1
lns3.scpt
repeat with i from 1 to (sourceDocumentSectionCount)
lns3.scpt
repeat with i from 1 to sourceDocumentSectionCount
lns3.scpt
tell section i
lns3.scpt
set thisSourceDocumentSectionsText to name of it
lns3.scpt
set the leavesNames to the name of leaves
lns3.scpt
set thisSourceDocumentSectionsText to ¬
lns3.scpt
thisSourceDocumentSectionsText & return & ¬
lns3.scpt
return & my textItemsToText(leavesNames)
lns3.scpt
set pagesSectionIndex to (i + bufferIndex)
lns3.scpt
set body text of section pagesSectionIndex to thisSourceDocumentSectionsText
lns3.scpt
tell section pagesSectionIndex
lns3.scpt
repeat with i from 1 to the count of paragraphs
lns3.scpt
set color of paragraph i to defaultSectionTypeColor
lns3.scpt
tell paragraph i
lns3.scpt
set font to defaultSectionTypeFace
lns3.scpt
set size to defaultSectionTypeSize
lns3.scpt
set color of paragraph i to defaultBodyTypeColor
lns3.scpt
set font to defaultBodyTypeFace
lns3.scpt
set size to defaultBodyTypeSize
lns3.scpt
set x to 2 -- title and TOC
lns3.scpt
set sectionStartIndexes to {}
lns3.scpt
set sectionTitleCounter to 1
lns3.scpt
set sectionDisplayNumber to 1
lns3.scpt
repeat with i from 2 to the count of sections
lns3.scpt
set the sectionStartPageIndex to x
lns3.scpt
set the end of the sectionStartIndexes to sectionStartPageIndex
lns3.scpt
if i is 2 then
lns3.scpt
set TOCText to "TABLE OF CONTENTS" & return
lns3.scpt
if useSectionTitleForTOC is true then
lns3.scpt