text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
return my moveWithResultItem:aFileOrPath intoFolder:folderOrPath withReplacing:replaceFlag newName:destName withReturnPath:pathFlag | lns3.scpt |
end move object | lns3.scpt |
on remove object aFileOrPath folders included foldersFlag : false | lns3.scpt |
if foldersFlag then | lns3.scpt |
return my deleteItem:aFileOrPath | lns3.scpt |
return my deleteFile:aFileOrPath | lns3.scpt |
end remove object | lns3.scpt |
on trash object aFileOrPath | lns3.scpt |
return my trashItem:aFileOrPath | lns3.scpt |
end trash object | lns3.scpt |
on rename object aFileOrPath to name proposedName return path pathFlag : false | lns3.scpt |
if pathFlag then | lns3.scpt |
return my renameWithResultItem:aFileOrPath newName:proposedName | lns3.scpt |
return my renameItem:aFileOrPath newName:proposedName | lns3.scpt |
end rename object | lns3.scpt |
on create alias to originalFileOrPath at aFileOrPath | lns3.scpt |
return my createAlias:aFileOrPath pointingTo:originalFileOrPath | lns3.scpt |
end create alias to | lns3.scpt |
on find original of aFileOrPath returning file fileFlag : false | lns3.scpt |
return my originalFromAlias:aFileOrPath asFile:fileFlag | lns3.scpt |
end find original of | lns3.scpt |
on create folder at folderOrPath use name proposedName : missing value | lns3.scpt |
if proposedName is missing value then | lns3.scpt |
return my createFolder:folderOrPath | lns3.scpt |
return my createFolderNamed:proposedName inFolder:folderOrPath | lns3.scpt |
end create folder at | lns3.scpt |
on sort objects listOfFilesOrPaths low to high ascendFlag : true sorted property sortProp : name property sort type sortType : case sensitive result type resType : paths list | lns3.scpt |
set resType to my stringFromRestype:resType | lns3.scpt |
if sortProp = name property or sortProp = extension property then | lns3.scpt |
if sortType = case sensitive then | lns3.scpt |
set sortStyle to "localizedCompare:" | lns3.scpt |
else if sortType = Finder like then | lns3.scpt |
set sortStyle to "localizedStandardCompare:" | lns3.scpt |
else if sortType = case insensitive then | lns3.scpt |
set sortStyle to "localizedCaseInsensitiveCompare:" | lns3.scpt |
else if sortType = fixed case insensitive then | lns3.scpt |
set sortStyle to "caseInsensitiveCompare:" | lns3.scpt |
else if sortType = fixed case sensitive then | lns3.scpt |
set sortStyle to "compare:" | lns3.scpt |
return (my sortByNameOrExtensionFilesOrPaths:listOfFilesOrPaths lowToHigh:ascendFlag sortingStyle:sortStyle resultType:resType byExtension:(sortProp = extension property)) | lns3.scpt |
if sortProp = modification property then | lns3.scpt |
set sortProp to "mod" | lns3.scpt |
else if sortProp = added property then | lns3.scpt |
set sortProp to "add" | lns3.scpt |
else if sortProp = created property then | lns3.scpt |
set sortProp to "cre" | lns3.scpt |
set sortProp to "las" | lns3.scpt |
return (my sortFilesOrPaths:listOfFilesOrPaths byProperty:sortProp lowToHigh:ascendFlag resultType:resType) | lns3.scpt |
end sort objects | lns3.scpt |
on objects of aFileOrPath searching subfolders recurseFlag : false include invisible items incInvis : false include folders incFolders : true include files incFiles : true result type resType : paths list | lns3.scpt |
if recurseFlag then | lns3.scpt |
set theResult to (my entireContentsOf:aFileOrPath includeInvisibles:incInvis includeFiles:incFiles includeFolders:incFolders resultType:resType) | lns3.scpt |
set theResult to (my contentsOf:aFileOrPath includeInvisibles:incInvis includeFiles:incFiles includeFolders:incFolders resultType:resType) | lns3.scpt |
end objects of | lns3.scpt |
on exists object aFileOrPath | lns3.scpt |
set aURL to my makeURLFromFileOrPath:aFileOrPath | lns3.scpt |
return (aURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean | lns3.scpt |
end exists object | lns3.scpt |
on object is folder aFileOrPath | lns3.scpt |
set {theResult, theValue, theError} to (aURL's getResourceValue:(reference) forKey:NSURLIsDirectoryKey |error|:(reference)) | lns3.scpt |
if theResult as boolean is false then error (theError's |localizedDescription|() as text) number (theError's code() as integer) | lns3.scpt |
if theValue as boolean then | lns3.scpt |
set {theResult, theValue, theError} to (aURL's getResourceValue:(reference) forKey:NSURLIsPackageKey |error|:(reference)) | lns3.scpt |
if not theValue as boolean then return true | lns3.scpt |
end object is folder | lns3.scpt |
on parse object aFileOrPath HFS results useHFS : false | lns3.scpt |
set theURL to my makeURLFromFileOrPath:aFileOrPath | lns3.scpt |
set theExt to theURL's pathExtension() | lns3.scpt |
set folderPath to theURL's path()'s stringByDeletingLastPathComponent() | lns3.scpt |
if useHFS then | lns3.scpt |
set folderName to folderPath's lastPathComponent()'s stringByReplacingOccurrencesOfString:":" withString:"/" | lns3.scpt |
set folderPath to ((POSIX file (folderPath as text)) as text) | lns3.scpt |
if folderPath does not end with ":" then set folderPath to folderPath & ":" | lns3.scpt |
set theName to theURL's lastPathComponent()'s stringByReplacingOccurrencesOfString:":" withString:"/" | lns3.scpt |
set folderName to folderPath's lastPathComponent() | lns3.scpt |
set theName to theURL's lastPathComponent() | lns3.scpt |
set stubName to theName's stringByDeletingPathExtension() | lns3.scpt |
set {theResult, theValue} to (theURL's getResourceValue:(reference) forKey:(current application's NSURLLocalizedNameKey) |error|:(missing value)) | lns3.scpt |
if theValue is not missing value then set theValue to theValue as text | lns3.scpt |
set {theResult, theKind} to (theURL's getResourceValue:(reference) forKey:(current application's NSURLLocalizedTypeDescriptionKey) |error|:(missing value)) | lns3.scpt |
if theKind is not missing value then set theKind to theKind as text | lns3.scpt |
return {full_name:theName as text, name_extension:theExt as text, name_stub:stubName as text, parent_folder_path:folderPath as text, parent_folder_name:folderName as text, displayed_name:theValue, file_kind:theKind} | lns3.scpt |
end parse object | lns3.scpt |
on compare object fileOrPathA to object fileOrPathB | lns3.scpt |
return my contentsOf:fileOrPathA equalsContentsOf:fileOrPathB | lns3.scpt |
end compare object | lns3.scpt |
on duplicateItem:aFileOrPath | lns3.scpt |
set theSourceURL to my makeURLFromFileOrPath:aFileOrPath | lns3.scpt |
set theDestFolderURL to theSourceURL's |URLByDeletingLastPathComponent|() | lns3.scpt |
return my copyURL:theSourceURL uniquelyToFolderURL:theDestFolderURL | lns3.scpt |
end duplicateItem: | lns3.scpt |
on copyItem:aFileOrPath intoFolder:folderOrPath withReplacing:replaceFlag | lns3.scpt |
set destName to theSourceURL's |lastPathComponent|() | lns3.scpt |
set theFolderURL to my makeURLFromFileOrPath:folderOrPath | lns3.scpt |
set theDestURL to theFolderURL's URLByAppendingPathComponent:destName | lns3.scpt |
return my copyFromURL:theSourceURL toURL:theDestURL withReplacing:replaceFlag | lns3.scpt |
end copyItem:intoFolder:withReplacing: | lns3.scpt |
on moveItem:aFileOrPath intoFolder:folderOrPath withReplacing:replaceFlag | lns3.scpt |
return my moveFromURL:theSourceURL toURL:theDestURL withReplacing:replaceFlag | lns3.scpt |
end moveItem:intoFolder:withReplacing: | lns3.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.