text
stringlengths
0
15.7k
source
stringlengths
6
112
(tempDict's setObject:theNull forKey:anAtt)
lns3.scpt
set attDict to (aResult's valuesForAttributes:requiredAtts)
lns3.scpt
set resultDict to tempDict's mutableCopy()
lns3.scpt
(resultDict's addEntriesFromDictionary:attDict)
lns3.scpt
(theResults's addObject:resultDict)
lns3.scpt
if datesFlag then
lns3.scpt
if AppleScript's version < "2.5" then set theResults to my _convertDatesInArray:theResults
lns3.scpt
return theResults as list
lns3.scpt
end searchOnlyIn:searchString:searchArgs:forAttributes:convertDates:namesOnly:
lns3.scpt
on searchIn:listOfScopes searchString:predString searchArgs:argList forAttributes:attList convertDates:datesFlag
lns3.scpt
theQuery's setSearchScopes:listOfScopes
lns3.scpt
if attList = missing value then -- only want the paths
lns3.scpt
end searchIn:searchString:searchArgs:forAttributes:convertDates:
lns3.scpt
on searchStringsFromSavedSearch:posixPath
lns3.scpt
set posixPath to current application's NSString's stringWithString:posixPath
lns3.scpt
if not (posixPath's pathExtension()'s isEqualToString:"savedSearch") as boolean then error "File is not a saved search"
lns3.scpt
set theData to the current application's NSData's dataWithContentsOfFile:posixPath
lns3.scpt
set {theDict, theError} to current application's NSPropertyListSerialization's propertyListWithData:theData options:(current application's NSPropertyListMutableContainersAndLeaves) format:(missing value) |error|:(reference)
lns3.scpt
if theDict = missing value then error (theError's localizedDescription() as text)
lns3.scpt
set theRawQuery to (theDict's valueForKey:"RawQuery")
lns3.scpt
set thePred to current application's NSPredicate's predicateFromMetadataQueryString:theRawQuery
lns3.scpt
return {theRawQuery as text, thePred's predicateFormat() as text}
lns3.scpt
end searchStringsFromSavedSearch:
lns3.scpt
on keysAndValuesForRecord:aRecord
lns3.scpt
set theDict to current application's NSDictionary's dictionaryWithDictionary:aRecord
lns3.scpt
set theKeys to (theDict's attributes())
lns3.scpt
set theValues to theDict's objectsForKeys:theKeys notFoundMarker:""
lns3.scpt
end keysAndValuesForRecord:
lns3.scpt
on metadataScopeConstants()
lns3.scpt
return {"kMDQueryScopeHome", "kMDQueryScopeNetwork", "kMDQueryScopeComputer", "kMDQueryScopeAllIndexed", "kMDQueryScopeComputerIndexed", "kMDQueryScopeNetworkIndexed", "See <https://developer.apple.com/documentation/coreservices/mdquery/query_search_scope_keys?language=objc> for details"}
lns3.scpt
end metadataScopeConstants
lns3.scpt
on convertDatesInRecord:theRecord
lns3.scpt
set theDict to current application's NSDictionary's dictionaryWithDictionary:theRecord
lns3.scpt
return (my _convertDatesInDict:theDict) as record
lns3.scpt
end convertDatesInRecord:
lns3.scpt
on convertDatesInList:theList
lns3.scpt
set theArray to current application's NSArray's arrayWithArray:theArray
lns3.scpt
return (my _convertDatesInArray:theArray) as list
lns3.scpt
end convertDatesInList:
lns3.scpt
on _convertDatesInDict:theDict
lns3.scpt
set mutDict to theDict's mutableCopy()
lns3.scpt
set theKeys to mutDict's allKeys()
lns3.scpt
set theValues to mutDict's objectsForKeys:theKeys notFoundMarker:""
lns3.scpt
repeat with i from 0 to (theValues's |count|()) - 1
lns3.scpt
set thisValue to (theValues's objectAtIndex:i)
lns3.scpt
if (thisValue's isKindOfClass:(current application's NSDate)) as boolean then
lns3.scpt
(mutDict's setObject:(my _makeASDateFrom:thisValue) forKey:(theKeys's objectAtIndex:i))
lns3.scpt
else if (thisValue's isKindOfClass:(current application's NSArray)) as boolean then
lns3.scpt
(mutDict's setObject:(my _convertDatesInArray:thisValue) forKey:(theKeys's objectAtIndex:i))
lns3.scpt
return mutDict
lns3.scpt
end _convertDatesInDict:
lns3.scpt
on _convertDatesInArray:theArray
lns3.scpt
set mutArray to theArray's mutableCopy()
lns3.scpt
repeat with i from 0 to (theArray's |count|()) - 1
lns3.scpt
set thisItem to (theArray's objectAtIndex:i)
lns3.scpt
if (thisItem's isKindOfClass:(current application's NSDate)) as boolean then
lns3.scpt
(mutArray's replaceObjectAtIndex:i withObject:(my _makeASDateFrom:thisItem))
lns3.scpt
else if (thisItem's isKindOfClass:(current application's NSDictionary)) as boolean then
lns3.scpt
(mutArray's replaceObjectAtIndex:i withObject:(my _convertDatesInDict:thisItem))
lns3.scpt
return mutArray
lns3.scpt
end _convertDatesInArray:
lns3.scpt
on _makeASDateFrom:theNSDate
lns3.scpt
set theCalendar to current application's NSCalendar's currentCalendar()
lns3.scpt
set theComponents to theCalendar's components:252 fromDate:theNSDate
lns3.scpt
set theYear to theComponents's |year|()
lns3.scpt
set theMonth to theComponents's |month|()
lns3.scpt
set theDay to theComponents's |day|()
lns3.scpt
set theHour to theComponents's hour()
lns3.scpt
set theMinute to theComponents's minute()
lns3.scpt
set theSeconds to theComponents's |second|()
lns3.scpt
using terms from scripting additions
lns3.scpt
tell (current date) to set {theASDate, year, day, its month, day, its hours, its minutes, its seconds} to {it, theYear, 1, theMonth, theDay, theHour, theMinute, theSeconds}
lns3.scpt
return theASDate
lns3.scpt
end _makeASDateFrom:
lns3.scpt
on _mdItemFrom:fileAliasURLOrPosixPath
lns3.scpt
set tempArray to current application's NSArray's arrayWithObject:fileAliasURLOrPosixPath
lns3.scpt
if tempArray's firstObject()'s isKindOfClass:(current application's |NSURL|'s |class|()) then
lns3.scpt
set targetURL to tempArray's firstObject()
lns3.scpt
set targetURL to current application's |NSURL|'s fileURLWithPath:(POSIX path of fileAliasURLOrPosixPath)
lns3.scpt
return current application's NSMetadataItem's alloc()'s initWithURL:targetURL
lns3.scpt
end _mdItemFrom:
lns3.scpt
use script "Myriad Tables Lib" version "1.0.9"
lns3.scpt
property theCheckbox : missing value
lns3.scpt
property thePopup : missing value
lns3.scpt
property theAccessoryView : missing value
lns3.scpt
set popupList to {"Fred", "Frieda", "George", "Georgina"}
lns3.scpt
if current application's NSThread's isMainThread() as boolean then
lns3.scpt
my createCheckBoxMainThread:{"Check me", "checkboxClicked:"}
lns3.scpt
my createPopupMainThread:{popupList, "Georgina"}
lns3.scpt
my buildAccessoryViewMainThread:{theCheckbox, thePopup}
lns3.scpt
my performSelectorOnMainThread:"createCheckBoxMainThread:" withObject:{"Check me", "checkboxClicked:"} waitUntilDone:true
lns3.scpt
my performSelectorOnMainThread:"createPopupMainThread:" withObject:{popupList, "Georgina"} waitUntilDone:true
lns3.scpt
my performSelectorOnMainThread:"buildAccessoryViewMainThread:" withObject:{theCheckbox, thePopup} waitUntilDone:true
lns3.scpt
set theTable to «event !©Mt!©Td» {"One", "Two", "Three", "Four", "Five"}
lns3.scpt
«event !©Mt!©Tm» theTable given «class !©Av»:theAccessoryView
lns3.scpt
set theAccessoryView to missing value -- to avoid error messages when saving
lns3.scpt
«event !©Mt!©Sd» theTable
lns3.scpt
set theState to theCheckbox's state() as boolean
lns3.scpt
set theCheckbox to missing value -- to avoid error messages when saving
lns3.scpt
set theValue to thePopup's title() as text
lns3.scpt