How to get the latest downloaded file name with applescript programatically?

后端 未结 2 1049
难免孤独
难免孤独 2021-01-16 12:17

I need to get the file name programatically on Mac, am using Selenium to download the file and from downloads folder i need to pick the same file to install programatically,

2条回答
  •  日久生厌
    2021-01-16 12:54

    Yes Mavericks does open the oldest, but this seams to work by specifying the last item.

    tell application "Finder" set latestFile to last item of (sort (get files of (path to downloads folder)) by creation date) as alias set fileName to latestFile's name end tell

提交回复
热议问题