Created
April 2, 2021 11:31
-
-
Save OKsign/113851b8ee1a2b286b12f758c9eeefef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- user options ---------------------------------------------- | |
set file_name to "untitled" | |
set file_name_with_current_date_time to "on" -- "on" or "off | |
set extension to ".txt" | |
-- end of user options --------------------------------------- | |
tell application "Finder" | |
activate | |
delay 0.6 | |
end tell | |
if file_name_with_current_date_time is "on" then | |
set DT to do shell script "date +%Y-%m-%d_%H.%M.%S" | |
tell application "Finder" to make new file at (the target of the front window) as alias with properties {name:file_name & " " & DT & extension} | |
delay 0.7 | |
else | |
tell application "Finder" to make new file at (the target of the front window) as alias with properties {name:file_name & extension} | |
delay 0.7 | |
end if | |
tell application "Finder" | |
sort (get files of (the target of the front window)) by modification date | |
set theFile to (last item of result) as alias | |
open theFile | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment