MacOS – How to execute AppleScript from Textedit

applescriptmacostextedit

I have the following AppleScript code in a Textedit file:

set the clipboard to (do shell script "date +%d/%m/%y")
tell application "System Events"
    keystroke tab using command down
    keystroke "v" using command down
end tell

How can I execute this code?

Best Answer

You can't execute AppleScript directly from TextEdit. Apple provides an AppleScript editor though in /Applications/Utilities/Script\ Editor.app which makes it easy to create and run AppleScript code.

Just navigate to /Applications/Utilities in Finder, run Script Editor and copy/paste your code into it.