Applescript Snippets


set varName to system attribute "EnvironmentVariableName"

on run argv
    repeat with currentArg in (every item of argv)
        display dialog currentArg
    end repeat
end run

on open aliases
    repeat with droppedAlias in (every item of aliases)
    end repeat
end open

Files and Folders

set EditorPosixPath to "/Applications/Utilities/AppleScript\"
set PlistPosixPath to "/Applications/Utilities/AppleScript\"

set EditorMacPath to "Macintosh HD:Applications:Utilities:AppleScript"
set AlternativeEditorPosixPath to POSIX path of EditorMacPath

-- POSIX file / alias must be used outside of Finder's scope
set EditorFile to POSIX file EditorPosixPath
set PlistFile to POSIX file PlistPosixPath
-- only for files
set PlistAlias to alias PlistPosixPath

-- as alias / container of are Finder's functions
tell application "Finder"
    set EditorPath to EditorFile as alias
    set ParentFolder to container of EditorPath

<!-- code language:text title: shell:false -->
    display dialog ParentFolder as text

<!-- code end -->end tell

No Comments