text
stringlengths
0
15.7k
source
stringlengths
6
112
paragraph 1 of document 1
lns3.scpt
folder "Applications" of startup disk
lns3.scpt
first item of first folder of first disk
lns3.scpt
first window's name
lns3.scpt
version of application "Finder" --result: "10.5.1"
lns3.scpt
name of item 1 of disk 2
lns3.scpt
set docRef to a reference to the first document
lns3.scpt
name of docRef --result: "New Report.rtf"
lns3.scpt
set docRef to a reference to document "New Report.rtf"
lns3.scpt
set myWindow to a ref to window "Q1.rtf" of application "TextEdit"
lns3.scpt
myWindow
lns3.scpt
contents of myWindow
lns3.scpt
get myWindow
lns3.scpt
set myWindow to a ref to window 1 of application "TextEdit"
lns3.scpt
name of myWindow --result: "Q1.rtf" (if that is the first window's name)
lns3.scpt
set myText to 2 as text
lns3.scpt
path to scripting additions as text
lns3.scpt
get name of first window
lns3.scpt
use application "Mail"
lns3.scpt
extract address from "John Doe <[email protected]>"
lns3.scpt
duplicate last file of window 1 of application "Finder"
lns3.scpt
if file "semaphore" of application "Finder" exists then
lns3.scpt
tell last file of window 1 of application "Finder"
lns3.scpt
duplicate
lns3.scpt
tell front document of application "TextEdit"
lns3.scpt
duplicate paragraph 1 to before paragraph 4
lns3.scpt
set circleArea to pi * 7 * 7 --result: 153.9380400259
lns3.scpt
set AppleScript's text item delimiters to {", "}
lns3.scpt
get last text item of "Hard Disk:CD Contents:Release Notes"
lns3.scpt
set AppleScript's text item delimiters to {":"}
lns3.scpt
set savedDelimiters to AppleScript's text item delimiters
lns3.scpt
set AppleScript's text item delimiters to {"**"}
lns3.scpt
set AppleScript's text item delimiters to savedDelimiters
lns3.scpt
on error m number n
lns3.scpt
error m number n
lns3.scpt
if version of AppleScript as string ≥ "1.9" then
lns3.scpt
version --result: "10.5.1"
lns3.scpt
version of AppleScript --result: "2.0"
lns3.scpt
get current application --result: current application
lns3.scpt
set myVariable to missing value
lns3.scpt
if myVariable is equal to missing value then
lns3.scpt
set notesFile to POSIX file "/Users/myUser/Feb_Meeting_Notes.rtf"
lns3.scpt
tell application "TextEdit" to open notesFile
lns3.scpt
set theFile to choose file name
lns3.scpt
set referenceNumber to open for access theFile with write permission
lns3.scpt
close access referenceNumber
lns3.scpt
set remoteMachine to "eppc://userName:[email protected]"
lns3.scpt
tell app "Finder" of machine remoteMachine to close front window
lns3.scpt
set remoteFinder to application "Finder" of machine ¬
lns3.scpt
"eppc://myUserName:[email protected]"
lns3.scpt
using terms from application "Finder"
lns3.scpt
tell remoteFinder
lns3.scpt
open application file id "com.apple.TextEdit"
lns3.scpt
display dialog "In factorial routine; x = " & (x as string)
lns3.scpt
set wordList to words in "Where is the hammer?"
lns3.scpt
repeat with currentWord in wordList
lns3.scpt
log currentWord
lns3.scpt
if contents of currentWord is equal to "hammer" then
lns3.scpt
display dialog "I found the hammer!"
lns3.scpt
property windowCount : 0
lns3.scpt
property defaultName : "Barry"
lns3.scpt
property strangeValue : (pi * 7)^2
lns3.scpt
set circumference to pi * 3.5 --result: 10.995574287564
lns3.scpt
copy circumference to savedResult --result: 10.995574287564 (copy of 1st variable)
lns3.scpt
local windowCount -- defines one variable
lns3.scpt
local agentName, agentNumber, agentHireDate -- defines three variables
lns3.scpt
set windowCount to 0 -- initialize to zero; an integer
lns3.scpt
set agentName to "James Smith" -- assign agent name; a text string
lns3.scpt
set agentNumber to getAgentNumber(agentName) -- call handler; an integer
lns3.scpt
copy current date to agentHireDate -- call current date command; a date
lns3.scpt
global gAgentCount
lns3.scpt
global gStatementDate, gNextAgentNumber
lns3.scpt
set gAgentCount to getCurrentAgentCount() -- call handler to get count
lns3.scpt
set gStatementDate to current date -- get date from current date command
lns3.scpt
set gNextAgentNumber to getNextAvailNumber() -- call handler to get number
lns3.scpt
set numClowns to 5 --result: 5
lns3.scpt
set myList to { 1, 2, "four" } --result: {1, 2, "four"}
lns3.scpt
set word1 to word 1 of front document --result: some word
lns3.scpt
set myList to { 1, 2, 3 }
lns3.scpt
set yourList to myList
lns3.scpt
set item 1 of myList to 4
lns3.scpt
set myName to "Sheila"
lns3.scpt
set yourName to myName
lns3.scpt
set x to {8, 94133, {firstName:"John", lastName:"Chapman"}}
lns3.scpt
set {p, q, r} to x
lns3.scpt
set {p, q, {lastName:r}} to x
lns3.scpt
set alpha to {property1:10, property2:20}
lns3.scpt
set beta to {1, 2, "Hello"}
lns3.scpt
set gamma to {alpha, beta, "Goodbye"}
lns3.scpt
copy gamma to delta
lns3.scpt
set property1 of alpha to 42
lns3.scpt
{alpha, beta, gamma, delta} -- List variables to show contents
lns3.scpt
set windowRef to a reference to window 1 of application "Finder"
lns3.scpt
name of windowRef --result: "Script testing folder"
lns3.scpt
copy windowRef to currentWindowRef --result: a new object specifier
lns3.scpt
name of currentWindowRef --result: "Script testing folder"
lns3.scpt
global currentCount
lns3.scpt
increment()
lns3.scpt
set currentCount to currentCount + 1
lns3.scpt
set currentCount to 1
lns3.scpt