# Keyboard shortcut icon snippet

**URL:** <https://forums.sketchup.com/t/keyboard-shortcut-icon-snippet/251717>\
**Category:** Ruby API\
**Tags:** keyboard-shortcuts\
**Created:** [December 13, 2023, 10:49am UTC](https://forums.sketchup.com/t/keyboard-shortcut-icon-snippet/251717 "2023-12-13T10:49:19Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 13, 2023, 1:20pm UTC](https://forums.sketchup.com/t/keyboard-shortcut-icon-snippet/251717/6 "2023-12-13T13:20:03Z")

</div>

On Windows platform you can use the Windows Scripting Host’s `SendKeys` method using Ruby’s `WIN32OLE` class.

See my example of sending the ESC key to exit editing contexts:

- [[Example] Send Escape Key - Cancel Operation script](https://forums.sketchup.com/t/example-send-escape-key-cancel-operation-script/115062)

REF:

- [`SendKeys` method (Windows Scripting Host)](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/8c6yea83(v=vs.84)?redirectedfrom=MSDN)

- [`WIN32OLE` class (Ruby)](https://docs.ruby-lang.org/en/3.2/WIN32OLE.html)

---

_[View the full topic](https://forums.sketchup.com/t/keyboard-shortcut-icon-snippet/251717)._
