text
stringlengths
0
15.7k
source
stringlengths
6
112
keystroke "NO_KEYSTROKE"
f1.applescript
on dlog(foo)
Save%20to%20Date.scpt
do shell script "logger -s \"" & replace_chars(foo, "\"", "\\\"") & "\""
Save%20to%20Date.scpt
local theMessages, savedMailboxName
Save%20to%20Date.scpt
if front window is not front message viewer's window then
Save%20to%20Date.scpt
tell application "System Events" to tell application process "Mail" to key code 123 using control down
Save%20to%20Date.scpt
set theMessages to selected messages of front message viewer
Save%20to%20Date.scpt
get eachMessage's mailbox
Save%20to%20Date.scpt
if the result's name is "sabi.net" or the result's container's name is "+" then
Save%20to%20Date.scpt
set savedMailboxName to "Saved (sabi.net)"
Save%20to%20Date.scpt
set savedMailboxName to "Saved"
Save%20to%20Date.scpt
get eachMessage's mailbox's account's mailbox "!"'s mailbox savedMailboxName
Save%20to%20Date.scpt
move eachMessage to the result
Save%20to%20Date.scpt
on error ee
Save%20to%20Date.scpt
my dlog("error: " & (ee as string))
Save%20to%20Date.scpt
choose from list {"Create a New Folder", "Clear an Existing Folder"} with title "Tag Folders" with prompt "Warning: selecting 'Clear an Existing Folder' will delete all folder contents." default items "Create a New Folder" OK button name "OK" cancel button name "Cancel" multiple selections allowed "false" empty selecti...
Tag%20Folders.scpt
set listanswer to result as text
Tag%20Folders.scpt
if listanswer = "Create a New Folder" or listanswer = "Clear an Existing Folder" then
Tag%20Folders.scpt
set loc to choose folder "Choose Folder Location" with prompt "Choose Output Location"
Tag%20Folders.scpt
if listanswer = "Clear an Existing Folder" then
Tag%20Folders.scpt
delete every item of folder loc
Tag%20Folders.scpt
if listanswer = "Create a New Folder" then
Tag%20Folders.scpt
set newtagfolder to "Tag Folders"
Tag%20Folders.scpt
set newtagfo to make new folder at loc with properties {name:newtagfolder}
Tag%20Folders.scpt
set loc2 to POSIX path of loc & newtagfolder
Tag%20Folders.scpt
set loc to (POSIX file loc2) as string
Tag%20Folders.scpt
set theAlertText to "Unable to create new folder."
Tag%20Folders.scpt
set theAlertMessage to "Make sure there's not already a folder called 'Tag Folders' at the destination and try again."
Tag%20Folders.scpt
display alert theAlertText message theAlertMessage as critical buttons {"Quit"} cancel button "Quit"
Tag%20Folders.scpt
set myList to do shell script "/usr/bin/mdfind -0 '(kMDItemUserTags == *)' |xargs -0 mdls -name kMDItemUserTags |grep '^ ' |cut -c5- |cut -d , -f 1 |sort -u | awk '{print}' ORS='; ' | sed '$s/..$//'"
Tag%20Folders.scpt
set AppleScript's text item delimiters to "; "
Tag%20Folders.scpt
set delimitedList to every text item of the myList
Tag%20Folders.scpt
repeat with theItem in delimitedList
Tag%20Folders.scpt
set newfolder to theItem
Tag%20Folders.scpt
set newfoldername to do shell script "echo " & newfolder & " | sed -e 's/^\"//' -e 's/\"$//'"
Tag%20Folders.scpt
set newfo to make new folder at loc with properties {name:newfoldername}
Tag%20Folders.scpt
set taggedFiles to do shell script "/usr/bin/mdfind -0 '(kMDItemUserTags == " & newfolder & ")'| tr \"\\000\" \"; \" | sed '$s/.$//'"
Tag%20Folders.scpt
set delimitedFiles to every text item of the taggedFiles
Tag%20Folders.scpt
set currentFolder to POSIX path of loc & newfoldername
Tag%20Folders.scpt
log loc
Tag%20Folders.scpt
log newfoldername
Tag%20Folders.scpt
log currentFolder
Tag%20Folders.scpt
repeat with theFile in delimitedFiles
Tag%20Folders.scpt
do shell script "cp -R -c " & quoted form of theFile & " " & quoted form of currentFolder
Tag%20Folders.scpt
log "The file could not be cloned. It's likely the file is on a different Volume and can't be cloned here, or this Volume is not in APFS format and doesn't support cloned files."
Tag%20Folders.scpt
set posixLoc to POSIX path of loc
Tag%20Folders.scpt
log (do shell script "find " & quoted form of posixLoc & " -type d -empty -delete")
Tag%20Folders.scpt
do shell script "xattr -rd com.apple.metadata:_kMDItemUserTags " & quoted form of posixLoc
Tag%20Folders.scpt
set loc to loc as alias
Tag%20Folders.scpt
set fileList to entire contents of loc
Tag%20Folders.scpt
repeat with i from 1 to number of items in fileList
Tag%20Folders.scpt
set this_item to item i of fileList
Tag%20Folders.scpt
set label index of this_item to 0
Tag%20Folders.scpt
open startup disk
open_finder.applescript
tell application "Finder" to open POSIX file "/Applications/Google Chrome.app/Contents/Frameworks/Google Chrome Framework.framework/Versions/Current/Resources/product_logo_32.png"
open_finder.applescript
display dialog "Please enter item's cost in dollars:" default answer ""
Script 11-11.applescript
set item_cost to (text returned of result) as real
Script 11-11.applescript
set total_charge to item_cost * 8.25 + 3.5 + 1.7
Script 11-11.applescript
display dialog "The total charge is $" & total_charge
Script 11-11.applescript
on pathsToFiles(thePaths)
Rename Manual.applescript
set theFiles to {}
Rename Manual.applescript
repeat with thePath in thePaths
Rename Manual.applescript
set end of theFiles to POSIX file thePath
Rename Manual.applescript
return theFiles
Rename Manual.applescript
on quotePaths(theFiles)
Rename Manual.applescript
set thePaths to ""
Rename Manual.applescript
repeat with theFile in theFiles
Rename Manual.applescript
set thePaths to thePaths & " " & quoted form of (POSIX path of (theFile as alias))
Rename Manual.applescript
return thePaths
Rename Manual.applescript
on renameFiles(theFiles)
Rename Manual.applescript
if (count of theFiles) is equal to 0 then return
Rename Manual.applescript
display dialog "Are you sure you want to rename these " & (count of theFiles) & " files?" with icon caution
Rename Manual.applescript
set homeFolder to POSIX path of (path to home folder) as string
Rename Manual.applescript
set renameCommand to homeFolder & ".local/bin/rename-manual " & my quotePaths(theFiles)
Rename Manual.applescript
reveal my pathsToFiles(paragraphs of (do shell script renameCommand))
Rename Manual.applescript
on open (theFiles)
Rename Manual.applescript
renameFiles(theFiles)
Rename Manual.applescript
tell application "Finder" to set theFiles to selection
Rename Manual.applescript
finderSelection()
finderSelection.applescript
on finderSelection()
finderSelection.applescript
set selectedFinderItems to selection
finderSelection.applescript
if selectedFinderItems is {} then return {}
finderSelection.applescript
set frontWindow to window 1
finderSelection.applescript
set currentView to current view of frontWindow
finderSelection.applescript
if currentView is icon view then
finderSelection.applescript
set itemArrangement to arrangement of icon view options of frontWindow
finderSelection.applescript
if itemArrangement is arranged by modification date then
finderSelection.applescript
set sortKey to "modification date"
finderSelection.applescript
else if itemArrangement is arranged by creation date then
finderSelection.applescript
set sortKey to "creation date"
finderSelection.applescript
else if itemArrangement is arranged by size then
finderSelection.applescript
set sortKey to "size"
finderSelection.applescript
else if itemArrangement is arranged by kind then
finderSelection.applescript
set sortKey to "kind"
finderSelection.applescript
else if itemArrangement is arranged by label then
finderSelection.applescript
set sortKey to "label"
finderSelection.applescript
set sortKey to "name"
finderSelection.applescript
else if currentView is list view then
finderSelection.applescript
set sortColumnName to name of sort column of list view options of frontWindow
finderSelection.applescript
if sortColumnName is modification date column then
finderSelection.applescript