mpacker 9 Posted May 4, 2020 Share Posted May 4, 2020 Any applescript ninjas out there who know how to do this? I am familiar with applying "static" tags when creating notes with applescript out of Hazel. I am not very familiar with how to use variables when assigning the tags. my current script would be tell application "Evernote" activate create note from file theFile notebook {"Statements"} tags {"FY1920"} synchronize end tell The FY1920 tag indicates "financial year 2019-2020". Right now when it clicks to a new year over I have to go in and update my scripts in Hazel. After years of doing this I would like to have them be created dynamically. Hazel can provide me the data via custom attributes. I need to be able to take the raw year data from the Hazel custom attribute, convert the date to just 2 digit year, subtract one year from the first one, add "FY" to the front of the string then use that string for tagging in the apple script. Anyone done this and could provide some code I could try? Link to comment
Level 5* DTLow 5,736 Posted May 4, 2020 Level 5* Share Posted May 4, 2020 5 hours ago, mpacker said: The FY1920 tag indicates "financial year 2019-2020". Right now when it clicks to a new year over I have to go in and update my scripts in Hazel. After years of doing this I would like to have them be created dynamically. Here's an example of working with dates set {year:y, month:m, day:d, hours:h, minutes:min, seconds:sec} to current dateset d to (text -2 thru -1 of ("0" & d as text))set m to m as integerset m to (text -2 thru -1 of ("0" & m as text))set y1 to y as integerset y2 to y1 - 1 Link to comment
mpacker 9 Posted May 4, 2020 Author Share Posted May 4, 2020 Thanks @DTLow This is helpful. Anyone have experience with variables in tag names, and how to do it considering the " ". Link to comment
Level 5* DTLow 5,736 Posted May 4, 2020 Level 5* Share Posted May 4, 2020 2 hours ago, mpacker said: Anyone have experience with variables in tag names, and how to do it considering the " ". You're currently using create note from file theFile notebook {"Statements"} tags {"FY1920"} Change to create note from file theFile notebook "Statements" tags {FYaabb} FYaabb is a variable (no quotes) You need to assign a value; something like Set FYaabb to "FY" & y2 & y1 y1 and y2 are variables which you need to assign values Link to comment
mpacker 9 Posted May 4, 2020 Author Share Posted May 4, 2020 Good tips, thanks. Hope to get a moment to work on this in the next week or so! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now