Hi, I’m trying to create an apple script and run it through Keyboard Maestro. The script will copy 2 specific files to the clipboard (the actual file. Not the name or the path) and automatically paste it into apple notes. I have it working the way I want it to if the file name is static. The problem is that file name contains the current month and year. For example “2021 June - FileName1”. This month it works great! Next month in July it won’t. How do I script it so that the file name that is copied has the current date in it. e.g. this month “2021 June - FileName1.jpg” next month “2021 July - FileName1.jpg”. I’ve tried setting variables for the date but I am very new to applescript and can’t figure out how to script it correctly. Any help would be greatly appreciated!
This is what I have so far:
*** Keyboard Maestro opens apple notes and makes a new note and then runs this applescript***
set the clipboard to POSIX file “/Users/MyName/Downloads/Bills/2021 June - FileName1.jpg”
delay 0.2
tell application “System Events” to key code 9 using {command down}
delay 0.2
set the clipboard to POSIX file “/Users/MyName/Downloads/Bills/2021 June - FileName2.pdf”
delay 0.2
tell application “System Events” to key code 9 using {command down}