text
stringlengths
0
15.7k
source
stringlengths
6
112
set {theDict, theError} to theURL's resourceValuesForKeys:{current application's NSURLHasHiddenExtensionKey, current application's NSURLIsDirectoryKey, current application's NSURLIsHiddenKey, current application's NSURLIsPackageKey} |error|:(reference) -- add keys as required
lns2.scpt
set theFrame to current application's NSScreen's mainScreen()'s frame()
lns2.scpt
set theFrame to current application's NSScreen's screens()'s firstObject()'s frame()
lns2.scpt
its setKeyEquivalent:"q"
lns2.scpt
its setKeyEquivalentModifierMask:(current application's NSEventModifierFlagCommand)
lns2.scpt
set oneButton to (its addButtonWithTitle:anEntry)
lns2.scpt
if contents of anEntry = "Quit" then
lns2.scpt
(oneButton's setKeyEquivalent:"q")
lns2.scpt
(oneButton's setKeyEquivalentModifierMask:(current application's NSEventModifierFlagCommand))
lns2.scpt
property NSEventModifierFlagCommand : a reference to 1048576
lns2.scpt
(oneButton's setKeyEquivalentModifierMask:NSEventModifierFlagCommand)
lns2.scpt
use mdLib : script "Metadata Lib" version "1.0.0"
lns2.scpt
set theFile to choose file
lns2.scpt
set theMetadata to mdLib's fetchMetadataFor:theFile
lns2.scpt
set theFolder to path to desktop
lns2.scpt
mdLib's searchFolders:{theFolder} searchString:"kMDItemFSName ENDSWITH[c] '.txt'" searchArgs:{}
lns2.scpt
mdLib's searchFolders:{theFolder} searchString:"kMDItemFSName ENDSWITH[c] %@" searchArgs:{".txt"} forAttributes:{"kMDItemFSSize"}
lns2.scpt
set theFolder to "~/Desktop"
lns2.scpt
set theFolder to current application's NSString's stringWithString:theFolder
lns2.scpt
set {theFiles, theError} to current application's NSFileManager's defaultManager()'s contentsOfDirectoryAtPath:(theFolder's stringByExpandingTildeInPath()) |error|:(reference)
lns2.scpt
set theFiles to (theFiles's pathsMatchingExtensions:{"txt"}) as list
lns2.scpt
set cmdStr0 to "find -H ~/Library/Script\\ Libraries -name '*.scpt'"
lns2.scpt
set cmdStr1 to "find -H ~/Library/Script\\ Libraries -name '*.scpt' -not -path '*.scptd*'"
lns2.scpt
set cmdStr2 to "find -H ~/Library/Script\\ Libraries -maxdepth 1 -name '*.scpt'"
lns2.scpt
set fileList0 to paragraphs of (do shell script cmdStr0)
lns2.scpt
set fileList1 to paragraphs of (do shell script cmdStr1)
lns2.scpt
set fileList2 to paragraphs of (do shell script cmdStr2)
lns2.scpt
set counts to {¬ count of fileList0, count of fileList1, count of fileList2}
lns2.scpt
return counts
lns2.scpt
set fromPosix to "/Users/ionah/Desktop/111/Some pic.tif" -- whatever
lns2.scpt
set toPosix to "/Users/ionah/Desktop/222/"
lns2.scpt
set theImage to (current application's NSImage's alloc()'s initWithContentsOfFile:fromPosix)
lns2.scpt
(current application's NSWorkspace's sharedWorkspace()'s setIcon:theImage forFile:toPosix options:0)
lns2.scpt
set destPath to "/Users/ionah/Desktop/Office Imports/555"
lns2.scpt
set thePasteboard to current application's NSPasteboard's generalPasteboard()
lns2.scpt
set listURL to thePasteboard's readObjectsForClasses:{current application's class "NSURL"} options:(missing value)
lns2.scpt
if listURL's |count|() = 0 then display alert "Le presse-papier n'a renvoyé aucune icône." message "Veuillez copier un élément du Finder." buttons {"Annuler"} cancel button 1
lns2.scpt
if listURL's |count|() > 1 then display alert "Le presse-papier a renvoyé trop d'éléments." message "Veuillez copier un fichier ou un dossier contenant une icône personnalisée ou fichier ICNS." buttons {"Annuler"} cancel button 1
lns2.scpt
set thePath to listURL's firstObject()'s |path|()
lns2.scpt
if thePath's hasSuffix:"icns" then
lns2.scpt
set theData to (current application's NSImage's alloc()'s initWithContentsOfFile:thePath)
lns2.scpt
set listImage to thePasteboard's readObjectsForClasses:{current application's class "NSImage"} options:(missing value)
lns2.scpt
set theData to listImage's firstObject()
lns2.scpt
set theWorkspace to (current application's NSWorkspace's sharedWorkspace())
lns2.scpt
(theWorkspace's setIcon:(missing value) forFile:destPath options:0)
lns2.scpt
set theResult to (theWorkspace's setIcon:theData forFile:destPath options:0)
lns2.scpt
(theWorkspace's noteFileSystemChanged:destPath)
lns2.scpt
if sourceFile ends with ".icns" then
lns2.scpt
(current application's NSWorkspace's sharedWorkspace()'s setIcon:imageData forFile:destPath options:0)
lns2.scpt
(current application's NSWorkspace's sharedWorkspace's noteFileSystemChanged:destPath)
lns2.scpt
set theShell to "/usr/local/bin/seticon " & quoted form of sourcePath & space & quoted form of destPath
lns2.scpt
do shell script theShell
lns2.scpt
set fromPosix to "/Users/Shared/Dropbox/SW/DEV/Images/Evernote-icon-512x512.png" -- whatever
lns2.scpt
set toPosix to "/Users/Shared/Dropbox/SW/DEV/Images/TEST for Icon Set.EN.Note.inetloc"
lns2.scpt
set theURL to listURL's firstObject()
lns2.scpt
if (theURL's pathExtension()'s isEqualToString:"icns") as boolean then
lns2.scpt
set theImage to (current application's NSImage's alloc()'s initWithContentsOfURL:theURL)
lns2.scpt
set {theResult, theImage, theError} to theURL's getResourceValue:(reference) forKey:(current application's NSURLCustomIconKey) |error|:(reference)
lns2.scpt
set theResult to (theWorkspace's setIcon:theImage forFile:(theURL's |path|()) options:0)
lns2.scpt
set picPath to POSIX path of (choose file with prompt "Choose pic file")
lns2.scpt
set theImage to current application's NSImage's alloc()'s initWithContentsOfFile:picPath
lns2.scpt
set thePath to POSIX path of (path to desktop)
lns2.scpt
set anNSURL to current application's |NSURL|'s fileURLWithPath:thePath
lns2.scpt
set destURL to anNSURL's URLByAppendingPathComponent:"Test folder"
lns2.scpt
set fm to current application's NSFileManager's defaultManager()
lns2.scpt
fm's createDirectoryAtURL:destURL withIntermediateDirectories:true attributes:(missing value) |error|:(missing value)
lns2.scpt
set ws to current application's NSWorkspace's sharedWorkspace()
lns2.scpt
ws's setIcon:theImage forFile:(destURL's |path|()) options:0
lns2.scpt
set theImage to (ws's iconForFile:(destURL's |path|()))
lns2.scpt
set newURL to (destURL's URLByAppendingPathComponent:("Folder " & i))
lns2.scpt
(fm's createDirectoryAtURL:newURL withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))
lns2.scpt
(ws's setIcon:theImage forFile:(newURL's |path|()) options:0)
lns2.scpt
set theImage to (ws's iconForFile:(newURL's |path|()))
lns2.scpt
set theURLString to "http://forum.latenightsw.com/t/escape-the-app-context-to-call-a-global-function/693/1"
lns2.scpt
current application's NSWorkspace's sharedWorkspace()'s openURL:(current application's |NSURL|'s URLWithString:theURLString)
lns2.scpt
set myFile to choose file
lns2.scpt
set myPosix to quoted form of POSIX path of myFile
lns2.scpt
set writable to do shell script "test -w " & myPosix & "; echo $?"
lns2.scpt
set writable to (do shell script "test -w " & myPosix & "; echo $?") = "0"
lns2.scpt
set cmdStr to "[ -w " & myPosix & " ] && echo \"TRUE\" || echo \"FALSE\""
lns2.scpt
log cmdStr
lns2.scpt
set isWritable to do shell script cmdStr
lns2.scpt
return isWritable
lns2.scpt
set myFile to POSIX path of (choose file)
lns2.scpt
set theURL to current application's |NSURL|'s fileURLWithPath:myFile
lns2.scpt
set {theResult, isWritable} to theURL's getResourceValue:(reference) forKey:(current application's NSURLIsWritableKey) |error|:(missing value)
lns2.scpt
set theEmails to (every email where its value ends with "@latenightsw.com") of every person
lns2.scpt
set theResult to {}
lns2.scpt
repeat with anEmail in theEmails
lns2.scpt
repeat with anItem in items of contents of anEmail
lns2.scpt
set end of theResult to value of contents of anItem
lns2.scpt
set theEmailAddresses to {}
lns2.scpt
set theNames to {}
lns2.scpt
set thePerson to «class from» of (contents of anItem as record)
lns2.scpt
set end of theEmailAddresses to value of contents of anItem
lns2.scpt
set end of theNames to (thePerson's first name) & " " & (thePerson's last name)
lns2.scpt
use AppleScript version "2.5" -- Mac OS 10.11 (El Capitan) or later.
lns2.scpt
set emailDomain to "gmail.com"
lns2.scpt
set |⌘| to current application
lns2.scpt
set contactStore to |⌘|'s class "CNContactStore"'s new()
lns2.scpt