text
stringlengths
0
15.7k
source
stringlengths
6
112
tell (current date) to set {eraStartDate, its day, its year, its month, its time} to {it, 1, 1, 1, 0}
lns3.scpt
copy eraStartDate to ADDate
lns3.scpt
tell ADDate to set {its year, its month} to {y, July}
lns3.scpt
set theASDate to eraStartDate - (ADDate - eraStartDate)
lns3.scpt
tell theASDate to set {its day, its month, its day, its hours, its minutes, its seconds} to {1, m, d, h, min, s}
lns3.scpt
set timeAdjustment to ((date (theASDate's time string)) - (date (recentDate's time string)))
lns3.scpt
set theASDate to theASDate - timeAdjustment
lns3.scpt
end makeASDateFrom
lns3.scpt
use AppleScript version "2.5"
lns3.scpt
set nowDate to current date
lns3.scpt
set nowNSDate to current application's NSDate's |date|()
lns3.scpt
set ASDate to nowDate - 10000 * days --> A date in 1990 on the day of posting.
lns3.scpt
set bridgedDate to current application's NSDate's dateWithTimeInterval:(0) sinceDate:(ASDate)
lns3.scpt
set bridgedDate2 to current application's NSDate's dateWithTimeInterval:(-10000 * days) sinceDate:nowDate
lns3.scpt
set theNSDate to current application's NSDate's dateWithTimeInterval:(-10000 * days) sinceDate:nowNSDate
lns3.scpt
return {bridgedDate, bridgedDate2, theNSDate}
lns3.scpt
on filteredContents:theFolder withUTI:wUTI |returning|:returnType recursive:wRecursive
lns3.scpt
set theFolderURL to current application's NSURL's fileURLWithPath:(POSIX path of theFolder)
lns3.scpt
set keysToRequest to current application's NSArray's arrayWithObject:(current application's NSURLTypeIdentifierKey)
lns3.scpt
set theFileManager to current application's NSFileManager's defaultManager()
lns3.scpt
if wRecursive = true then
lns3.scpt
set allURLs to (theFileManager's enumeratorAtURL:theFolderURL includingPropertiesForKeys:keysToRequest options:6 errorHandler:(missing value))'s allObjects()
lns3.scpt
set allURLs to theFileManager's contentsOfDirectoryAtURL:theFolderURL includingPropertiesForKeys:keysToRequest options:4 |error|:(missing value)
lns3.scpt
set predArray to current application's NSMutableArray's new()
lns3.scpt
repeat with aKind in wUTI
lns3.scpt
(predArray's addObject:(current application's NSPredicate's predicateWithFormat_("%K UTI-CONFORMS-TO %@", current application's NSURLTypeIdentifierKey, aKind)))
lns3.scpt
set thePredicate to current application's NSCompoundPredicate's orPredicateWithSubpredicates:predArray
lns3.scpt
set theURLs to current application's NSMutableArray's new()
lns3.scpt
repeat with oneURL in allURLs
lns3.scpt
set keyValue to (oneURL's resourceValuesForKeys:keysToRequest |error|:(missing value))
lns3.scpt
if ((thePredicate's evaluateWithObject:keyValue) as boolean) then (theURLs's addObject:oneURL)
lns3.scpt
if returnType = "name" then return (theURLs's valueForKey:"lastPathComponent") as list
lns3.scpt
if returnType = "path" then return (theURLs's valueForKey:"path") as list
lns3.scpt
if returnType = "url" then return theURLs
lns3.scpt
end filteredContents:withUTI:|returning|:recursive:
lns3.scpt
my filteredContents:"/Applications" withUTI:{"public.image", "com.adobe.pdf"} |returning|:"file" recursive:true
lns3.scpt
set typeIdentifierKey to current application's NSURLTypeIdentifierKey
lns3.scpt
set keysToRequest to current application's NSArray's arrayWithObject:(typeIdentifierKey)
lns3.scpt
(predArray's addObject:(current application's NSPredicate's predicateWithFormat_("self UTI-CONFORMS-TO %@", aKind)))
lns3.scpt
set conformingUTIs to ""
lns3.scpt
set unconformingUTIs to ""
lns3.scpt
set thisUTI to end of (oneURL's getResourceValue:(reference) forKey:typeIdentifierKey |error|:(missing value))
lns3.scpt
set thisUTIAsText to linefeed & thisUTI & linefeed
lns3.scpt
if (unconformingUTIs contains thisUTIAsText) then
lns3.scpt
else if (conformingUTIs contains thisUTIAsText) then
lns3.scpt
(theURLs's addObject:oneURL)
lns3.scpt
else if ((thePredicate's evaluateWithObject:thisUTI) as boolean) then -- This works even if thisUTI is missing value.
lns3.scpt
set conformingUTIs to conformingUTIs & thisUTIAsText
lns3.scpt
set unconformingUTIs to unconformingUTIs & thisUTIAsText
lns3.scpt
script o
lns3.scpt
property theURLs : {}
lns3.scpt
set end of o's theURLs to oneURL
lns3.scpt
set theURLs to current application's NSArray's arrayWithArray:(o's theURLs)
lns3.scpt
tell application "SSD MacPro:System:Library:Input Methods:CharacterPalette.app:"
lns3.scpt
tell process "Emoji et symboles"
lns3.scpt
select row 2 of table 1 of scroll area 1 of splitter group 1 of splitter group 1 of window "Caractères"
lns3.scpt
tell process "Emoji & Symbols"
lns3.scpt
select row 2 of table 1 of scroll area 1 of splitter group 1 of splitter group 1 of window "Characters"
lns3.scpt
keystroke space using {command down, control down}
lns3.scpt
tell process "Emoji et symboles" -- or tell process "CharacterPalette"
lns3.scpt
splitter group 1 of splitter group 1 of window 1
lns3.scpt
select row 2 of table 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1
lns3.scpt
set theDate to ((current date) - 1 * days)
lns3.scpt
set theCal to current application's NSCalendar's currentCalendar()
lns3.scpt
if theCal's isDateInToday:theDate then
lns3.scpt
set theDay to "Aujourd'hui"
lns3.scpt
else if theCal's isDateInYesterday:theDate then
lns3.scpt
set theDay to "Hier"
lns3.scpt
set theFormatter to "EEEE d MMMM"
lns3.scpt
set dateFormat to current application's NSDateFormatter's alloc()'s init()
lns3.scpt
dateFormat's setDateFormat:theFormatter
lns3.scpt
set theDay to (dateFormat's stringFromDate:theDate) as text
lns3.scpt
set theFormatter to "HH:mm:ss"
lns3.scpt
set theHour to (dateFormat's stringFromDate:theDate) as text
lns3.scpt
set theString to theDay & " à " & theHour
lns3.scpt
dateFormat's setDateStyle:(current application's NSDateFormatterLongStyle)
lns3.scpt
dateFormat's setTimeStyle:(current application's NSDateFormatterMediumStyle)
lns3.scpt
dateFormat's setDoesRelativeDateFormatting:true
lns3.scpt
set theString to do shell script "diskutil list -plist"
lns3.scpt
set theString to current application's NSString's stringWithString:theString
lns3.scpt
set {theDict, theError} to current application's NSPropertyListSerialization's propertyListWithData:theData options:0 |format|:(missing value) |error|:(reference)
lns3.scpt
if theDict is missing value then error (theError's localizedDescription() as text)
lns3.scpt
set partitionInfo to theDict's valueForKeyPath:"AllDisksAndPartitions.Partitions"
lns3.scpt
set partitionInfos to current application's NSMutableArray's array()
lns3.scpt
repeat with anInfo in partitionInfo
lns3.scpt
if not (anInfo's isKindOfClass:(current application's NSNull)) then (partitionInfos's addObjectsFromArray:anInfo)
lns3.scpt
set thePred to current application's NSPredicate's predicateWithFormat:"(Content BEGINSWITH %@) AND (NOT Content IN %@)" argumentArray:{"Apple_", {"Apple_Boot", "Apple_CoreStorage"}}
lns3.scpt
partitionInfos's filterUsingPredicate:thePred
lns3.scpt
(partitionInfos's valueForKey:"VolumeName") as list
lns3.scpt
set {theDict, theError} to current application's NSPropertyListSerialization's propertyListWithData:theData options:0 format:(missing value) |error|:(reference)
lns3.scpt
set volumeNames to (partitionInfos's valueForKey:"VolumeName")'s mutableCopy()
lns3.scpt
set mountedVolumes to theDict's objectForKey:"VolumesFromDisks"
lns3.scpt
volumeNames's removeObjectsInArray:mountedVolumes
lns3.scpt
set unmountedVolumes to volumeNames as list
lns3.scpt
ModifyMenu() -- Original call in the applet
lns3.scpt
ModifyTargetsOfItems() -- my own procedure to set the menu items's target to me
lns3.scpt
on ModifyTargetsOfItems()
lns3.scpt
set theMenuItem to ((current application's NSApp's mainMenu()'s itemAtIndex:0)'s submenu())'s itemAtIndex:0
lns3.scpt
theMenuItem's setTarget:me
lns3.scpt
set theMenuItem to ((current application's NSApp's mainMenu()'s itemAtIndex:1)'s submenu())'s itemAtIndex:0
lns3.scpt