text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
set FileName to TheFilePath's lastPathComponent() -- Uses NSString's lastPathComponent function | lns2.scpt |
if ((offset of "\\" in (FileName as text)) ≠ 0) then | lns2.scpt |
set FileName to SeachAndReplace("\\", "\\\\", (FileName as text)) -- Replace every backslash in file name with 4 backslashes | lns2.scpt |
set EnclosingFolderPath to TheFilePath's stringByDeletingLastPathComponent() -- Uses NSString's stringByDeletingLastPathComponent function | lns2.scpt |
(SearchQuery's setPredicate:SearchPredicate) --Adds the Predicate to the SearchQuery | lns2.scpt |
(SearchQuery's setSearchScopes:{EnclosingFolderPath}) -- Tells SearchQuery where to search | lns2.scpt |
SearchQuery's startQuery() -- Starts the search process | lns2.scpt |
set TheResult to my CreateResults(VideoName, PixelHeight, PixelWidth, FileSize, ItemKind, LengthInSeconds, AudioBitRate, VideoBitRate) | lns2.scpt |
set nameList to {} | lns2.scpt |
set fSelection to selection as alias list | lns2.scpt |
repeat with f in fSelection | lns2.scpt |
set end of nameList to name of f | lns2.scpt |
set fSelection to selection as text | lns2.scpt |
set nameList to paragraphs of cng("^.+:([^:]+):?$", "\\1", fSelection) of me | lns2.scpt |
on cng(_find, _replace, _data) | lns2.scpt |
change _find into _replace in _data with regexp without case sensitive | lns2.scpt |
end cng | lns2.scpt |
use theLib : script "Myriad Tables Lib" version "1.0.7" | lns2.scpt |
set theInfo to swap columns and rows in {nameList, fSelection} | lns2.scpt |
set theResult to display table with data theInfo row template {text, missing value} with prompt "Pick a file" with double click means OK | lns2.scpt |
set theFile to item 2 of item 1 of values selected of theResult | lns2.scpt |
set textToSearch to "The quick Red Fox jumped over the brown fox's back" | lns2.scpt |
set textToSearch to ReplaceConderingCase(textToSearch, "fox", "dog") | lns2.scpt |
on ReplaceConderingCase(textToSearch, stringToFind, replacementString) | lns2.scpt |
set NSCaseInsensitiveSearch to a reference to 1 | lns2.scpt |
set NSString to a reference to current application's NSString | lns2.scpt |
set textToSearch to NSString's stringWithString:textToSearch | lns2.scpt |
set textToSearch to (textToSearch's stringByReplacingOccurrencesOfString:stringToFind withString:replacementString options:NSCaseInsensitiveSearch range:{0, textToSearch's |length|()}) as text | lns2.scpt |
return textToSearch | lns2.scpt |
end ReplaceConderingCase | lns2.scpt |
set textToSearch to ReplaceIgnoringCase(textToSearch, "fox", "dog") | lns2.scpt |
on ReplaceIgnoringCase(textToSearch, stringToFind, replacementString) | lns2.scpt |
set aString to NSString's stringWithString:textToSearch | lns2.scpt |
set sourceString to (aString's stringByReplacingOccurrencesOfString:stringToFind withString:replacementString options:NSCaseInsensitiveSearch range:{0, aString's |length|()}) as text | lns2.scpt |
end ReplaceIgnoringCase | lns2.scpt |
set fileORURL to choose folder with prompt "Select a folder" | lns2.scpt |
set contentsList to FolderContents(fileORURL) | lns2.scpt |
set entireContentsList to FolderEntireContents(fileORURL) | lns2.scpt |
on FolderContents(fileORURL) | lns2.scpt |
set NSDirectoryEnumerationSkipsHiddenFiles to a reference to 4 | lns2.scpt |
set NSFileManager to a reference to current application's NSFileManager | lns2.scpt |
set {theURLs, theError} to NSFileManager's defaultManager()'s contentsOfDirectoryAtURL:fileORURL includingPropertiesForKeys:{} options:(NSDirectoryEnumerationSkipsHiddenFiles) |error|:(reference) | lns2.scpt |
if theURLs is equal to missing value then error (theError's localizedDescription() as text) | lns2.scpt |
set allPosixPaths to (theURLs's valueForKey:"path") as list | lns2.scpt |
return allPosixPaths | lns2.scpt |
end FolderContents | lns2.scpt |
on FolderEntireContents(fileORURL) | lns2.scpt |
set NSDirectoryEnumerationSkipsPackageDescendants to a reference to 2 | lns2.scpt |
set theURLs to (NSFileManager's defaultManager()'s enumeratorAtURL:fileORURL includingPropertiesForKeys:{} options:(NSDirectoryEnumerationSkipsPackageDescendants + (get NSDirectoryEnumerationSkipsHiddenFiles)) errorHandler:(missing value))'s allObjects() | lns2.scpt |
end FolderEntireContents | lns2.scpt |
set aList to {"The", "Quick", "Red", "Fox", "The", "Red", "Fox", "is", "Quick"} | lns2.scpt |
set uniqueList to RemoveDuplicatesFromList(aList) | lns2.scpt |
on RemoveDuplicatesFromList(aList) | lns2.scpt |
set NSOrderedSet to a reference to current application's NSOrderedSet | lns2.scpt |
set aList to (NSOrderedSet's orderedSetWithArray:aList)'s array() as list | lns2.scpt |
return aList | lns2.scpt |
end RemoveDuplicatesFromList | lns2.scpt |
set OptionKeyDown to IsOptionKeyDown() | lns2.scpt |
on IsOptionKeyDown() | lns2.scpt |
set NSAlternateKeyMask to a reference to 524288 | lns2.scpt |
set NSEvent to a reference to current application's NSEvent | lns2.scpt |
set theResult to (((NSEvent's modifierFlags()) div (get NSAlternateKeyMask)) mod 2) = 1 | lns2.scpt |
end IsOptionKeyDown | lns2.scpt |
set folderToSearchPath to "~/Documents/Test" | lns2.scpt |
set curApp to current application | lns2.scpt |
set NSFileManager to a reference to curApp's NSFileManager | lns2.scpt |
set nsPath to curApp's NSString's stringWithString:folderToSearchPath | lns2.scpt |
set nsPath to nsPath's stringByResolvingSymlinksInPath() | lns2.scpt |
set folderNSURL to curApp's |NSURL|'s fileURLWithPath:nsPath | lns2.scpt |
set theURLs to (NSFileManager's defaultManager()'s enumeratorAtURL:folderNSURL includingPropertiesForKeys:{} options:(NSDirectoryEnumerationSkipsPackageDescendants + (get NSDirectoryEnumerationSkipsHiddenFiles)) errorHandler:(missing value))'s allObjects() | lns2.scpt |
with timeout of 60 seconds -- Doesn't help. Still locks up. | lns2.scpt |
set folderItemList to (theURLs's valueForKey:"path") as list | lns2.scpt |
set #=~folderToSearchPath~# to "~/Documents/Test" | lns2.scpt |
set nsPath to curApp's NSString's stringWithString:#=~folderToSearchPath~# | lns2.scpt |
set nsItemURLList to (NSFileManager's defaultManager()'s enumeratorAtURL:folderNSURL includingPropertiesForKeys:{} options:(NSDirectoryEnumerationSkipsPackageDescendants + (get NSDirectoryEnumerationSkipsHiddenFiles)) errorHandler:(missing value))'s allObjects() | lns2.scpt |
set #~folderItemList~# to (nsItemURLList's valueForKey:"path") as list | lns2.scpt |
set appList to theWorkspace's runningApplications() | lns2.scpt |
set scriptableList to current application's NSMutableArray's array() | lns2.scpt |
repeat with anApp in appList | lns2.scpt |
set {theResult, isScriptable, theError} to ((anApp's bundleURL())'s getResourceValue:(reference) forKey:(current application's NSURLApplicationIsScriptableKey) |error|:(reference)) | lns2.scpt |
if isScriptable as boolean then (scriptableList's addObject:(anApp's localizedName())) | lns2.scpt |
scriptableList as list | lns2.scpt |
tell application "System Events" to set scriptableList to name of application processes whose has scripting terminology is true | lns2.scpt |
set imagePath to POSIX path of (choose file) | lns2.scpt |
set imageRep to current application's NSBitmapImageRep's imageRepWithContentsOfFile:imagePath | lns2.scpt |
set theColor to imageRep's colorAtX:10 y:10 | lns2.scpt |
set theRed to theColor's redComponent() | lns2.scpt |
set theGreen to theColor's greenComponent() | lns2.scpt |
set theBlue to theColor's blueComponent() | lns2.scpt |
set theAlpha to theColor's alphaComponent() | lns2.scpt |
set tempRep to current application's NSBitmapImageRep's imageRepWithContentsOfFile:imagePath | lns2.scpt |
set imageRep to tempRep's bitmapImageRepByConvertingToColorSpace:(current application's NSColorSpace's genericRGBColorSpace()) renderingIntent:0 | lns2.scpt |
set theColor to imageRep's colorAtX:50 y:50 | lns2.scpt |
set theRed to round ((theColor's redComponent()) * 256) rounding down | lns2.scpt |
set theGreen to round ((theColor's greenComponent()) * 256) rounding down | lns2.scpt |
set theBlue to round ((theColor's blueComponent()) * 256) rounding down | lns2.scpt |
set theSpace to theColor's colorSpace() | lns2.scpt |
{theRed, theGreen, theBlue, theAlpha, theSpace} | lns2.scpt |
set {theDict, theError} to current application's NSFileManager's defaultManager()'s attributesOfItemAtPath:thePath |error|:(reference) | lns2.scpt |
set theURL to current application's |NSURL|'s fileURLWithPath:thePath | lns2.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.