text
stringlengths
0
15.7k
source
stringlengths
6
112
set the current pane to pane "Displays"
03-revealing-anchors.applescript
set anchorNames to name of every anchor of current pane
03-revealing-anchors.applescript
log anchorNames as text
03-revealing-anchors.applescript
reveal anchor "displaysArrangementTab" of current pane
03-revealing-anchors.applescript
set AppleScript's text item delimiters to savedDelimiter
03-revealing-anchors.applescript
set theCommand to "open ~/Library/Application\\ Support/Code/Backups"
Open Backups.applescript
on format24h(provided_date)
get-todays-calendar-events.applescript
set the_time to time string of provided_date -- something like "4:20:56 PM"
get-todays-calendar-events.applescript
set am_pm to characters -2 thru -1 of the_time as string -- is it AM or PM
get-todays-calendar-events.applescript
set the_hour to text item 1 of the_time as string -- in this example, "4"
get-todays-calendar-events.applescript
set the_minute to text item 2 of the_time as string -- in this example, "20"
get-todays-calendar-events.applescript
if (the_hour as string is not "12") and (am_pm is "PM") then
get-todays-calendar-events.applescript
set the_hour to the_hour + 12
get-todays-calendar-events.applescript
if the_hour as string is "24" then
get-todays-calendar-events.applescript
set the_hour to "12"
get-todays-calendar-events.applescript
if (count of (the_hour as string)) is 1 then -- padding with a zero if necessary
get-todays-calendar-events.applescript
set the_hour to "0" & the_hour
get-todays-calendar-events.applescript
if (count of (the_minute as string)) is 1 then -- padding with a zero if necessary
get-todays-calendar-events.applescript
set the_minute to "0" & the_minute
get-todays-calendar-events.applescript
set time_string to (the_hour as string) & ":" & the_minute as string -- putting the pieces together
get-todays-calendar-events.applescript
set AppleScript's text item delimiters to oldDelims -- cleaning up
get-todays-calendar-events.applescript
return time_string as string
get-todays-calendar-events.applescript
log "error converting " & provided_date & " to 24hr time"
get-todays-calendar-events.applescript
end format24h
get-todays-calendar-events.applescript
on getEventString(an_event)
get-todays-calendar-events.applescript
return summary of an_event as string
get-todays-calendar-events.applescript
end getEventString
get-todays-calendar-events.applescript
on changeCaseOfText(theText, theCaseToSwitchTo)
get-todays-calendar-events.applescript
if theCaseToSwitchTo contains "lower" then
get-todays-calendar-events.applescript
set theComparisonCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
get-todays-calendar-events.applescript
set theSourceCharacters to "abcdefghijklmnopqrstuvwxyz"
get-todays-calendar-events.applescript
else if theCaseToSwitchTo contains "upper" then
get-todays-calendar-events.applescript
set theComparisonCharacters to "abcdefghijklmnopqrstuvwxyz"
get-todays-calendar-events.applescript
set theSourceCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
get-todays-calendar-events.applescript
set theAlteredText to ""
get-todays-calendar-events.applescript
repeat with aCharacter in theText
get-todays-calendar-events.applescript
set theOffset to offset of aCharacter in theComparisonCharacters
get-todays-calendar-events.applescript
if theOffset is not 0 then
get-todays-calendar-events.applescript
set theAlteredText to (theAlteredText & character theOffset of theSourceCharacters) as string
get-todays-calendar-events.applescript
set theAlteredText to (theAlteredText & aCharacter) as string
get-todays-calendar-events.applescript
return theAlteredText
get-todays-calendar-events.applescript
end changeCaseOfText
get-todays-calendar-events.applescript
on cleanString(subjectTxt, prefixesToRemove)
get-todays-calendar-events.applescript
set cleanedSubject to changeCaseOfText(subjectTxt, "lower")
get-todays-calendar-events.applescript
repeat with prefix in prefixesToRemove
get-todays-calendar-events.applescript
set cleanedSubject to findAndReplaceInText(cleanedSubject, prefix, "")
get-todays-calendar-events.applescript
set cleanedSubject to trimText(cleanedSubject, " ", "both")
get-todays-calendar-events.applescript
return cleanedSubject
get-todays-calendar-events.applescript
end cleanString
get-todays-calendar-events.applescript
set prefixList to {"re:", "fw:", "[external]", "recall:"}
get-todays-calendar-events.applescript
set theStartDate to current date
get-todays-calendar-events.applescript
set hours of theStartDate to 0
get-todays-calendar-events.applescript
set minutes of theStartDate to 0
get-todays-calendar-events.applescript
set seconds of theStartDate to 0
get-todays-calendar-events.applescript
set theEndDate to theStartDate + (1 * days) - 1
get-todays-calendar-events.applescript
display notification ("Checking for calendar entries between " & theStartDate as string) & " - " & theEndDate as string
get-todays-calendar-events.applescript
set myResult to ""
get-todays-calendar-events.applescript
tell calendar "REPLACE WITH YOUR CALENDAR NAME HERE"
get-todays-calendar-events.applescript
set todaysEvents to (every event where its start date is greater than or equal to theStartDate and end date is less than or equal to theEndDate)
get-todays-calendar-events.applescript
display notification "Found " & ((count of todaysEvents) as string) & " event(s) for calendar entries between " & (theStartDate as string) & " - " & theEndDate as string
get-todays-calendar-events.applescript
repeat with myEvent in todaysEvents
get-todays-calendar-events.applescript
set body to summary of myEvent as string
get-todays-calendar-events.applescript
set startTime to start date of myEvent
get-todays-calendar-events.applescript
set endTime to end date of myEvent
get-todays-calendar-events.applescript
set startStr to my format24h(startTime as date)
get-todays-calendar-events.applescript
set endStr to my format24h(endTime as date)
get-todays-calendar-events.applescript
set timeRange to startStr & "-" & endStr
get-todays-calendar-events.applescript
set eventStr to timeRange & " " & body
get-todays-calendar-events.applescript
set myResult to myResult & "
get-todays-calendar-events.applescript
" & eventStr
get-todays-calendar-events.applescript
set clipboard_text to myResult
get-todays-calendar-events.applescript
set the clipboard to clipboard_text
get-todays-calendar-events.applescript
display notification "Copied to clipboard: " & myResult
get-todays-calendar-events.applescript
set myVersion to "1.1"
iTunes SED.applescript
set myName to "iTunes SED"
iTunes SED.applescript
set allColumns to {"Song Name", "Artist", "Album", "Comments", "Composer"}
iTunes SED.applescript
return do shell script "echo " & quoted form of theText & " | tr '\\r' '\\n' | sed -e " & quoted form of sedCommand
iTunes SED.applescript
display dialog "Thank you for downloading my " & myName & " script!" & return & return & "You can visit my website and get more free AppleScripts to use with iTunes, iPhoto and Address Book!" buttons {"Later", "OK"} default button 2 with icon 1
iTunes SED.applescript
set userTracks to the selection of front window
iTunes SED.applescript
if userTracks is {} then
iTunes SED.applescript
display dialog myName & return & return & "Please first select the desired tracks" with icon 2 buttons {"OK"} default button 1
iTunes SED.applescript
set totalTracks to count of userTracks
iTunes SED.applescript
set userColumn to choose from list allColumns with prompt "SED will be used on:"
iTunes SED.applescript
if userColumn is false then return -- User pressed Cancel
iTunes SED.applescript
set userColumn to userColumn as text
iTunes SED.applescript
display dialog myName & return & return & "Type the full SED command to be applied to \"" & userColumn & "\"" default answer "s/this/that/" buttons {"Cancel", "Run SED"} default button 2 with icon 1
iTunes SED.applescript
set userText to the text returned of result as text
iTunes SED.applescript
repeat with i from 1 to totalTracks
iTunes SED.applescript
set theTrack to item i of userTracks
iTunes SED.applescript
if userColumn is "Artist" then
iTunes SED.applescript
set the artist of theTrack to my substitute(userText, artist of theTrack)
iTunes SED.applescript
else if userColumn is "Album" then
iTunes SED.applescript
set the album of theTrack to my substitute(userText, album of theTrack)
iTunes SED.applescript
else if userColumn is "Song Name" then
iTunes SED.applescript
set the name of theTrack to my substitute(userText, name of theTrack)
iTunes SED.applescript
else if userColumn is "Comments" then
iTunes SED.applescript
set the comment of theTrack to my substitute(userText, comment of theTrack)
iTunes SED.applescript
else if userColumn is "Composer" then
iTunes SED.applescript
set the composer of theTrack to my substitute(userText, composer of theTrack)
iTunes SED.applescript
if runCount mod 10 is 0 then
iTunes SED.applescript