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,
This will give you the latest file (sorted by creation date) of your downloads folder:
tell application "Finder"
set latestFile to item 1 of (sort (get files of (path to downloads folder)) by creation date) as alias
set fileName to latestFile's name
end tell