text
stringlengths
0
15.7k
source
stringlengths
6
112
set [output, E] to the result
+files.applescript
__any__(output)
+files.applescript
end runWorkflow
+files.applescript
on metadata for fp
+files.applescript
set mdItem to NSMetadataItem's alloc()'s initWithURL:__alias__(fp)
+files.applescript
tell (mdItem's attributes() as list) to if {} ≠ it then ¬
+files.applescript
return (mdItem's valuesForAttributes:it) as record
+files.applescript
end metadata
+files.applescript
on mdQuery at directories as list : {"~/"} given query:query
+files.applescript
local query
+files.applescript
repeat with dir in directories
+files.applescript
set dir's contents to __alias__(dir)
+files.applescript
tell NSMetadataQuery's new()
+files.applescript
setSearchScopes_(directories)
+files.applescript
setPredicate_(NSPredicate's predicateWithFormat:query)
+files.applescript
startQuery()
+files.applescript
repeat while isGathering() as boolean
+files.applescript
stopQuery()
+files.applescript
(results()'s valueForKey:kMDPathKey) as list
+files.applescript
end mdQuery
+files.applescript
on cbSet:(fs as list)
+files.applescript
local fs
+files.applescript
set f's contents to __alias__(f)
+files.applescript
tell the Pasteboard
+files.applescript
clearContents()
+files.applescript
writeObjects_(aliases in fs)
+files.applescript
end cbSet:
+files.applescript
on cbSet(fs)
+files.applescript
cbSet_(fs)
+files.applescript
end cbSet
+files.applescript
on cbGet()
+files.applescript
(Pasteboard's readObjectsForClasses:[NSURL] options:[]) as list
+files.applescript
end cbGet
+files.applescript
on deepDive into dir for filetypes as text : ("") ¬
+files.applescript
given name:filename as boolean : false ¬
+files.applescript
, path:filepath as boolean : true ¬
+files.applescript
, size:filesize as boolean : false ¬
+files.applescript
, creation date:cdate as boolean : false ¬
+files.applescript
, parent:container as boolean : false ¬
+files.applescript
, folders:directories as boolean : true ¬
+files.applescript
, modification date:mdate as boolean : false
+files.applescript
local dir, filename, filepath, filesize, cdate, container
+files.applescript
local directories, mdate, filetypes
+files.applescript
set keys to {IsDirectoryKey}
+files.applescript
if filepath then set end of keys to PathKey
+files.applescript
if filesize then set end of keys to FileSizeKey
+files.applescript
if filename then set end of keys to NameKey
+files.applescript
if container then set end of keys to ParentURLKey
+files.applescript
if cdate then set end of keys to CreationDateKey
+files.applescript
if mdate then set end of keys to ModificationDateKey
+files.applescript
set fURLs to NSMutableArray's array()
+files.applescript
fURLs's addObjectsFromArray:((FileManager's ¬
+files.applescript
enumeratorAtURL:__NSURL__(dir) ¬
+files.applescript
includingPropertiesForKeys:keys ¬
+files.applescript
options:(SkipHiddenFiles + SkipPackageDescendants) ¬
+files.applescript
errorHandler:nil)'s allObjects())
+files.applescript
set predicate to "ANY %@ ==[c] pathExtension"
+files.applescript
if filetypes begins with "!" then set predicate ¬
+files.applescript
to ["!", predicate] as text
+files.applescript
set filetypes to the words of filetypes
+files.applescript
set |?| to NSPredicate's predicateWithFormat_(predicate, filetypes)
+files.applescript
if {} ≠ filetypes then fURLs's filterUsingPredicate:|?|
+files.applescript
repeat with f in fURLs
+files.applescript
if directories or (((f's ¬
+files.applescript
resourceValuesForKeys:[IsDirectoryKey] |error|:nil)'s ¬
+files.applescript
valueForKey:IsDirectoryKey) as boolean = false) then
+files.applescript
(f's resourceValuesForKeys:(rest of keys) |error|:nil)
+files.applescript
null
+files.applescript
set f's contents to the result
+files.applescript
fURLs's removeObject:(null)
+files.applescript
if the number of keys > 2 then return fURLs as list
+files.applescript
fURLs's sortUsingDescriptors:[NSSortDescriptor's alloc()'s ¬
+files.applescript
initWithKey:(end of keys) ascending:yes]
+files.applescript
(fURLs's valueForKey:(end of keys)) as list
+files.applescript
end deepDive
+files.applescript
on filesTagged by tag given caseMatching:matchCase as boolean : false ¬
+files.applescript
, fuzziness:fuzzy as boolean : true
+files.applescript
local tag, matchCase, fuzzy
+files.applescript
set [op, flag] to ["CONTAINS", "[c] "]
+files.applescript
if matchCase then set flag to " "
+files.applescript
if not fuzzy then set op to "=="
+files.applescript
set query to ["kMDItemUserTags", space, op, flag, tag's quoted form]
+files.applescript
mdQuery given query:query as text
+files.applescript
end filesTagged
+files.applescript
set theRating to 100 -- 5 stars
5-star.scpt
global std, textUtil, retry, uni, regex, syseve, winUtil
terminal copy.applescript
repeat until getLingeringCommand() is missing value
terminal copy.applescript
tell application "System Events" to key code 13 using {control down} -- w
terminal copy.applescript
current application's NSWorkspace's sharedWorkspace()'s openURL:(current application's NSURL's URLWithString:"x-apple.systempreferences:com.apple.Displays-Settings.extension")
activate_HDR.applescript
set hdr to checkbox 1 of group 3 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Displays" of application process "System Settings" of application "System Events"
activate_HDR.applescript
tell hdr
activate_HDR.applescript
if value is 0 then click it
activate_HDR.applescript
if upttime contains "6 days" then
RestartReminder.applescript
display alert "Restart Your Computer"
RestartReminder.applescript
set _toDaysDate to do shell script "date '+%Y.%m.%d'"
listened to.applescript
on SaR(sourceText, findText, replaceText)
listened to.applescript
set {atid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, findText}
listened to.applescript
set tempText to text items of sourceText
listened to.applescript
set sourceText to tempText as string
listened to.applescript
end SaR
listened to.applescript