text
stringlengths
0
15.7k
source
stringlengths
6
112
on createScaledQRCodeImageObjectForString(thisString, targetWidth, targetHeight)
lns3.scpt
set baseImageSize to baseImage's extent()'s |size|()
lns3.scpt
set xScale to targetWidth / (baseImageSize's width())
lns3.scpt
set yScale to targetHeight / (baseImageSize's height())
lns3.scpt
set aTransform to current application's CGAffineTransform's CGAffineTransformMakeScale(xScale, yScale)
lns3.scpt
end createScaledQRCodeImageObjectForString
lns3.scpt
set startingSlide to current slide
lns3.scpt
duplicate (get current slide)
lns3.scpt
tell the last slide
lns3.scpt
set slideText to object text of the default title item
lns3.scpt
if slideText begins with ":" then
lns3.scpt
set amountInMinutes to "0"
lns3.scpt
set amountInSeconds to first word of slideText
lns3.scpt
set amountInMinutes to first word of slideText
lns3.scpt
set amountInSeconds to second word of slideText
lns3.scpt
if amountInSeconds is "00" then
lns3.scpt
set newSeconds to "59"
lns3.scpt
if amountInMinutes is "0" then
lns3.scpt
set newMinutes to ""
lns3.scpt
set newMinutes to ¬
lns3.scpt
((amountInMinutes as integer) - 1) as string
lns3.scpt
if newMinutes is "0" then set newMinutes to ""
lns3.scpt
set newSeconds to ¬
lns3.scpt
((amountInSeconds as integer) - 1) as string
lns3.scpt
if length of newSeconds is 1 then
lns3.scpt
set newSeconds to "0" & newSeconds
lns3.scpt
set newMinutes to amountInMinutes
lns3.scpt
set newTime to newMinutes & ":" & newSeconds
lns3.scpt
set object text of the default title item to newTime
lns3.scpt
if newTime is ":00" then exit repeat
lns3.scpt
set the transition properties of every slide to {transition effect:no transition effect, transition duration:0, transition delay:1, automatic transition:true}
lns3.scpt
start front document from startingSlide
lns3.scpt
tell application id "com.apple.iWork.Numbers"
lns3.scpt
if not (exists document 1) then error number 1000
lns3.scpt
display dialog "This script will create a new table for tracking " & ¬
lns3.scpt
"the attendance of the people in a chosen Contacts group." & ¬
lns3.scpt
return & return & ¬
lns3.scpt
"Should the table include Saturdays and Sundays?" buttons ¬
lns3.scpt
{"Cancel", "Omit Weekends", "Include Weekends"} default button 3
lns3.scpt
if the button returned of the result is "Include Weekends" then
lns3.scpt
set includeWeekends to true
lns3.scpt
set includeWeekends to false
lns3.scpt
if application id "com.apple.AddressBook" is not running then
lns3.scpt
set AddressBookWasOpen to false
lns3.scpt
tell application id "com.apple.AddressBook" to launch
lns3.scpt
set AddressBookWasOpen to true
lns3.scpt
tell application id "com.apple.AddressBook"
lns3.scpt
set the AddressBookGroupNames to the name of every group
lns3.scpt
if the AddressBookGroupNames is {} then error number 1001
lns3.scpt
set the chosenGroup to ¬
lns3.scpt
(choose from list the AddressBookGroupNames ¬
lns3.scpt
with prompt "Pick the Contacts group to be used for the table:")
lns3.scpt
if the chosenGroup is false then error number -128
lns3.scpt
set the chosenGroup to the chosenGroup as string
lns3.scpt
set thesePeople to every person of group chosenGroup
lns3.scpt
if thesePeople is {} then error number 1002
lns3.scpt
set the fullNames to {}
lns3.scpt
repeat with i from 1 to the count of thesePeople
lns3.scpt
set thisPerson to item i of thesePeople
lns3.scpt
set the end of the fullNames to ¬
lns3.scpt
(last name of thisPerson) & ", " & (first name of thisPerson)
lns3.scpt
set the peopleCount to the count of the fullNames
lns3.scpt
if AddressBookWasOpen is false then
lns3.scpt
tell application id "com.apple.AddressBook" to quit
lns3.scpt
set tempDate to the current date
lns3.scpt
set the columnTitles to {}
lns3.scpt
set day of tempDate to 1
lns3.scpt
set thisMonth to the month of tempDate
lns3.scpt
repeat until month of tempDate is not thisMonth
lns3.scpt
set thisDay to day of tempDate
lns3.scpt
set thisWeekday to the (weekday of tempDate) as string
lns3.scpt
if includeWeekends is true or (includeWeekends is false and ¬
lns3.scpt
thisWeekday is not in {"Saturday", "Sunday"}) then
lns3.scpt
set the dayTitle to ¬
lns3.scpt
(thisDay & "-" & (text 1 thru 1 of thisWeekday)) as string
lns3.scpt
set the end of the columnTitles to the dayTitle
lns3.scpt
set tempDate to tempDate + (1 * days)
lns3.scpt
set the dayCount to the count of the columnTitles
lns3.scpt
set the tableName to chosenGroup & space & ¬
lns3.scpt
(text 1 thru 3 of (thisMonth as string) & ¬
lns3.scpt
"-" & year of (the current date)) as string
lns3.scpt
set tableName to my incrementTableNameIfNeeded(tableName, "-")
lns3.scpt
tell the active sheet
lns3.scpt
set thisTable to make new table with properties ¬
lns3.scpt
{column count:dayCount + 2, row count:peopleCount + 1, name:tableName}
lns3.scpt
tell thisTable
lns3.scpt
set the height of every row to 24
lns3.scpt
set the vertical alignment of every row to center
lns3.scpt
set the alignment of every row to center
lns3.scpt
set the vertical alignment to center
lns3.scpt
set the alignment to center
lns3.scpt
repeat with i from 2 to dayCount + 1
lns3.scpt
set value of cell i to item (i - 1) of the columnTitles
lns3.scpt
set the alignment to left
lns3.scpt
set width to 128
lns3.scpt
repeat with i from 2 to peopleCount + 1
lns3.scpt
set value of cell i to item (i - 1) of the fullNames
lns3.scpt
tell columns 2 thru -2
lns3.scpt
set width to 36
lns3.scpt
set the rangeStart to the name of cell 2 of column 2
lns3.scpt