1
votes

I have this script that I have been working on to clear out my Caches and application support files I will skip to the part that I need help with;


tell application "System Events"
    keystroke "o" using {command down}
        delay 0.5
    keystroke delete using {command down}
end tell

When the script gets to the keystroke delete using {command down} I get the error message;

error "System Events got an error: Can’t continue using." number -1708

How can I improve?

1
You are mixing up AppleScript terminology with key codes. The AS delete command does not respond to key modifiers. Why do you use (a sort of) GUI scripting rather than deleting the files directly? - vadian

1 Answers

10
votes

You use not keystroke, but the related key code to access special keys.

tell application "System Events"
    key code 51 using {command down}
end tell

See full reference of key codes here.