1
votes

One of the exercises from the text book has me stumped, example script:

tell application "Finder"

    tell folder "AppleScript" of folder "Applications"
        set file_list to name of every item
        set time_folder_was_created to creation date
        set time_folder_was_modified to modification date

    end tell
end tell

Script Editor keeps giving me this result: error "Finder got an error: Can’t get folder \"Applications\"." number -1728 from folder "Applications"

Does this have something to do with an outdated process or OS 10.11 security for Applications folder or I'm just not seeing it.

1

1 Answers

0
votes

The folder Applications is a subfolder of the startup disk

tell application "Finder"
    tell folder "AppleScript" of folder "Applications" of startup disk
        set file_list to name of every item
        set time_folder_was_created to creation date
        set time_folder_was_modified to modification date
    end tell
end tell

or with a relative path

set applicationsFolder to path to applications folder as text 
tell application "Finder"
    tell folder "AppleScript" of folder applicationsFolder
        set file_list to name of every item
        set time_folder_was_created to creation date
        set time_folder_was_modified to modification date
    end tell
end tell