-- functions
-- replace characters
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
-- split text
on splitText(theText, theDelimiter)
set AppleScript's text item delimiters to theDelimiter
set theTextItems to every text item of theText
set AppleScript's text item delimiters to ""
return theTextItems
end splitText
-- Actions
-- Action 1: Replace the word TIME with the Date and Time.
set shortDate to weekday & ", " & month & " " & days & " at "
set shortTime to hours & ":" & minutes
set pasteboard to the clipboard
set datePrint to shortDate & " at " & shortTime
set finalProduct to replace_chars(pasteboard, "TIME", datePrint)
set the clipboard to finalProduct
This copies nothing to the clipboard. Whereas if you swap out the following
set shortDate to date string of (current date)
set shortTime to time string of (current date)
I get returned "Thursday, May 24, 2018 at 1:42:47 PM"
My end objective is to replace the word "TIME" with the "Date without the year" & " at " & "Time without the seconds"
I'd also like to find some way to keep the AM or PM aspect of of the time but it might just be easier to find some way to trim off that last section.
Any input on this at all would be great. If theres anyone who has a notion as to why the first set of code doesn't work but the second set does I'd love to hear it.
Best Answer
It should be like this:
Or to meet your actual goal:
Since AppleScript is not case sensitive your script will also replace "time" or "Time" ... so you will need the considering statement: