AppleScript Examples

AppleScript syntax highlighting

AppleScript Syntax Highlighting

-- File Management Script on processFiles(fileList) set resultList to {} repeat with theFile in fileList try tell application "Finder" set fileName to name of theFile set fileSize to size of theFile if fileSize > 1000000 then set end of resultList to fileName end if end tell on error errMsg display dialog "Error: " & errMsg end try end repeat return resultList end processFiles -- Main script tell application "Finder" set desktopFolder to path to desktop set allFiles to every file of desktopFolder -- Filter large files set largeFiles to my processFiles(allFiles) if (count of largeFiles) > 0 then display dialog "Found " & (count of largeFiles) & " large files" else display notification "No large files found" end if end tell -- Text manipulation set myString to "Hello, World!" set upperString to do shell script "echo " & quoted form of myString & " | tr '[:lower:]' '[:upper:]'"