text
stringlengths
0
15.7k
source
stringlengths
6
112
set the rangeEnd to the name of last cell of column -2
lns3.scpt
tell range (rangeStart & ":" & rangeEnd)
lns3.scpt
set format to checkbox
lns3.scpt
tell last column
lns3.scpt
set width to 60
lns3.scpt
set the value of cell 1 to "MISSED"
lns3.scpt
set alignment to center
lns3.scpt
repeat with i from 2 to the count of rows
lns3.scpt
tell row i
lns3.scpt
set the rangeString to (name of cell 2 & ":" & name of cell -2)
lns3.scpt
set the formulaString to "=COUNTIF(" & rangeString & ", FALSE)"
lns3.scpt
set the value of the last cell to formulaString
lns3.scpt
sort by column 1 direction ascending
lns3.scpt
return thisTable
lns3.scpt
set alertString to "MISSING NUMBERS RESOURCE"
lns3.scpt
set errorMessage to "Please create or open a document before running this script."
lns3.scpt
set alertString to "MISSING CONTACTS RESOURCE"
lns3.scpt
set errorMessage to "There are no groups in your Contacts."
lns3.scpt
set errorMessage to "There are no people in the chosen Contacts group."
lns3.scpt
set alertString to "EXECUTION ERROR"
lns3.scpt
if the errorNumber is not -128 then
lns3.scpt
display alert alertString message errorMessage buttons {"Cancel"}
lns3.scpt
on incrementTableNameIfNeeded(thisTableName, thisDivider)
lns3.scpt
set the theseTableNames to the name of every table
lns3.scpt
set the testTableName to the thisTableName
lns3.scpt
set incrementor to 0
lns3.scpt
repeat until testTableName is not in theseTableNames
lns3.scpt
set incrementor to incrementor + 1
lns3.scpt
set the testTableName to ¬
lns3.scpt
thisTableName & thisDivider & (incrementor as string)
lns3.scpt
return the testTableName
lns3.scpt
end incrementTableNameIfNeeded
lns3.scpt
tell active sheet
lns3.scpt
set the selectedTable to ¬
lns3.scpt
(the first table whose class of selection range is range)
lns3.scpt
error number 1001
lns3.scpt
set the intersectionBackgroundColor to {65535, 65535, 65535} -- white
lns3.scpt
set the intersectionTextColor to {0, 0, 0} -- black
lns3.scpt
set the backgroundColor to {52428, 26214, 65535}
lns3.scpt
set the textColor to {65535, 65535, 65535}
lns3.scpt
tell selectedTable
lns3.scpt
set the selectionRange to the selection range
lns3.scpt
set theseColumns to the columns of selection range
lns3.scpt
set theseRows to the rows of selection range
lns3.scpt
repeat with i from 1 to the count of theseColumns
lns3.scpt
set thisColumn to item i of theseColumns
lns3.scpt
set the background color of thisColumn to backgroundColor
lns3.scpt
set the text color of thisColumn to textColor
lns3.scpt
set the font name of thisColumn to "Helvetica"
lns3.scpt
set the font size of thisColumn to 15
lns3.scpt
repeat with i from 1 to the count of theseRows
lns3.scpt
set thisRow to item i of theseRows
lns3.scpt
set the background color of thisRow to backgroundColor
lns3.scpt
set the text color of thisRow to textColor
lns3.scpt
set the font name of thisRow to "Helvetica"
lns3.scpt
set the font size of thisRow to 15
lns3.scpt
set background color of selectionRange to intersectionBackgroundColor
lns3.scpt
set the text color of selectionRange to intersectionTextColor
lns3.scpt
set alertString to "MISSING RESOURCE"
lns3.scpt
set alertString to "SELECTION ERROR"
lns3.scpt
set errorMessage to "Please select a table before running this script."
lns3.scpt
set thisTable to the first table whose class of selection range is range
lns3.scpt
display dialog ¬
lns3.scpt
"Save the entire table, or just the selection range, as an image?" buttons ¬
lns3.scpt
{"Cancel", "Range", "Table"} default button 3 with icon 1
lns3.scpt
set the userChoice to the button returned of the result
lns3.scpt
if the userChoice is "Table" then
lns3.scpt
set thisRange to the selection range
lns3.scpt
set the selection range to the cell range
lns3.scpt
tell application "System Events" to ¬
lns3.scpt
set the selection range to thisRange
lns3.scpt
set tableName to the name
lns3.scpt
set the defaultName to (tableName & ".png")
lns3.scpt
set the defaultName to (tableName & space & "Selection" & ".png")
lns3.scpt
set the targetImageFile to (choose file name default name defaultName)
lns3.scpt
set targetImageFileHFSPath to targetImageFile as string
lns3.scpt
if targetImageFileHFSPath does not end with ".png" then
lns3.scpt
set targetImageFileHFSPath to targetImageFileHFSPath & ".png"
lns3.scpt
set the imageData to get the clipboard as «class PNGf»
lns3.scpt
set the writeResult to my writeToFile(imageData, targetImageFileHFSPath, false)
lns3.scpt
if writeResult is true then
lns3.scpt
display dialog "The table image has been created." buttons ¬
lns3.scpt
{"Send Image", "Show Image File", "OK"} default button 3 with icon 1
lns3.scpt
set userChoice to the button returned of the result
lns3.scpt
if userChoice is "Send Image" then
lns3.scpt
open document file targetImageFileHFSPath ¬
lns3.scpt
using application file id "com.apple.mail"
lns3.scpt
else if userChoice is "Show Image File" then
lns3.scpt
reveal document file targetImageFileHFSPath
lns3.scpt
error "There was a problem writing the image file."
lns3.scpt
if errorNumber is -1719 then
lns3.scpt
display alert errorNumber message errorMessage
lns3.scpt
set the openTargetFile to open for access file targetFile with write permission
lns3.scpt
write thisData to the openTargetFile starting at eof --as «class PNGf»
lns3.scpt
log ("SCRIPT ERROR: " & errorMessage)
lns3.scpt
set the headerTitles to {"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"}
lns3.scpt
display dialog "Use the state names as column headers or row headers?" buttons ¬
lns3.scpt
{"Cancel", "Row Headers", "Column Headers"}
lns3.scpt
if the userChoice is "Row Headers" then
lns3.scpt
set rowCount to (length of the headerTitles) + 1
lns3.scpt