Special Keys: what to type to simulate deleteKey?

To delete some items using keyboard shortcut, I am using the following command “command+Delete”.
I tried to simulate this command with typeCommand “\D” as suggested in the Eggplant Reference, but it does not work.
Is there another typeCommand “” that works?
Thanks.

I believe this is what you’ll want:

typeText commandDown, backspace, commandUp

The TypeCommand command doesn’t support the special characters – those can only be used with the TypeText command. Also, be careful of the fact that Delete and Backspace are two distinct keys (even though both are often labelled “Delete” on keyboards). I just tested the command above and successfully deleted a file in my Mac SUT’s Finder, if that’s what you’re attempting. :slight_smile:

Thanks a lot,
This is exactly what I needed!
anna.

I have included that code in a Redstone Library function called

to TypeCommandDelete  x
  if x is not a positive integer then set x to 1
  repeat x times
    TypeText  commandDown, backspace, commandUp
    wait 10 ticks  -- can be safely removed
  end repeat
end TypeCommandDelete

which may be of help to you. Just include this as a helper to a suite, or even in your own libraries that you start using when you first run a master script.