Hello, I have a functioning Automator Quick Action that creates a dated text file in whatever current directory I’m in. I just want to Automator to append numbers if a file name already exists, but I’m unsure how to do so using a solution posted elsewhere on this forum. Here’s the script I have working:
set myName to date_format((current date) as string)
to date_format(old_date) -- Old_date is text, not a date.
set {year:y, month:m, day:d} to date old_date
tell (y * 10000 + m * 100 + d) as string to text 1 thru 4 & "-" & text 5 thru 6 & "-" & text 7 thru 8 & "_Note_.txt"
end date_format
tell application "Finder"
set txt to make new file at (the target of the front window) as alias with properties {name:myName as string}
select txt
end tell
I am trying to implement DJ Bazzie Wazzie’s solution posted here:
https://macscripter.net/viewtopic.php?id=36082
but I am stuck on the line:
set existingFiles to list folder fileLocation with invisibles
… I’m not sure what to use as fileLocation if I want the service to operate in any directory on my computer? Is his solution not the way to go for what I have already? I appreciate any help.