Created
April 16, 2024 06:56
-
-
Save dreness/1d6f536b7b9c5628431324a9725c7b47 to your computer and use it in GitHub Desktop.
Revisions
-
dreness created this gist
Apr 16, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ use scripting additions use framework "Foundation" tell application "Finder" -- path to frontmost Finder window set windowPath to POSIX path of (target of front window as alias) -- selected items in Finder, if any set itemlist to selection as alias list if length of itemlist > 0 then repeat with i from 1 to length of itemlist set the_item to item i of itemlist set the_result to POSIX path of the_item return {windowPath, the_result} end repeat else -- there are no selected items in the frontmost Finder window. set d to seconds of (current date) as string set cocoaDate to current application's NSDate's dateWithTimeInterval:0 sinceDate:(current date) set theSeconds to cocoaDate's timeIntervalSince1970() -- silly hack to get out of scientific notation. -- Almost any intermediate unit will suffice. set epochSeconds to theSeconds as ounces as string set newFile to windowPath & epochSeconds & ".txt" do shell script "touch " & newFile end if end tell