;This code moves cursor down one line, presses HOME key.
;Then highlights 9 characters of text correctly, but fails to delete the ;highlighted text. I am using Windows 11.
sendkey("{DOWN}")
sendkey("{HOME}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
SendKey("+{RIGHT}")
display( 5, "DELETE","Will delete timestamp in 5")
sendkey("{DEL}")
pause("done","yes")
exit
The problem was this line:
display( 5, "DELETE","Will delete timestamp in 5")
when I removed that line DELETE worked.
When you run Display(), it is most likely changing the focus so the {DEL} is not going to the window you want. You could try a TimeDelay() to give it time to return, assuming it would, or use WinActivate() on the Window you want the {DEL} sent to. I would recommend the latter as it should be a sure thing. You might need a TimeDelay() after it as well.
Jim