<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to perform a key press  'Enter' in Python? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13194950#M442</link>
    <description>&lt;P&gt;After most of the operation, I have to press 'Enter' to finish, 'Enter' is not in a easy position to press.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is that a way I can write a python script to perform a 'Enter' press?&lt;/STRONG&gt; then binding it to 'SPACE', much more easy to press.&lt;/P&gt;&lt;P&gt;I have already write some shortcut in Python to make it easy to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I just press a 'G' button then I can go back to home view. It's quite a easy command like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def command_execute(args: adsk.core.CommandEventArgs):
    futil.log(f"{CMD_NAME} Command Execute Event")

    ## Go HOME!!!!
    app.activeViewport.goHome()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then set a shortcut 'g' in Fusion, then every time I press 'G', it go back to home view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So how can I send a 'Enter' in python to Fusion interface?&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;imitate a key press 'Enter' then send it to Fusion to finish an operation?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only information I got now is the keycode of 'Enter'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;EnterKeyCode&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;16777221&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Enter&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advanced if you can share some experience with me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acupen_0-1733406538800.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1442437i931ECCA38C421AD4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="acupen_0-1733406538800.png" alt="acupen_0-1733406538800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2024 14:00:53 GMT</pubDate>
    <dc:creator>acupen</dc:creator>
    <dc:date>2024-12-05T14:00:53Z</dc:date>
    <item>
      <title>How to perform a key press  'Enter' in Python?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13194950#M442</link>
      <description>&lt;P&gt;After most of the operation, I have to press 'Enter' to finish, 'Enter' is not in a easy position to press.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is that a way I can write a python script to perform a 'Enter' press?&lt;/STRONG&gt; then binding it to 'SPACE', much more easy to press.&lt;/P&gt;&lt;P&gt;I have already write some shortcut in Python to make it easy to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I just press a 'G' button then I can go back to home view. It's quite a easy command like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def command_execute(args: adsk.core.CommandEventArgs):
    futil.log(f"{CMD_NAME} Command Execute Event")

    ## Go HOME!!!!
    app.activeViewport.goHome()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then set a shortcut 'g' in Fusion, then every time I press 'G', it go back to home view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So how can I send a 'Enter' in python to Fusion interface?&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;imitate a key press 'Enter' then send it to Fusion to finish an operation?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only information I got now is the keycode of 'Enter'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;EnterKeyCode&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;16777221&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Enter&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advanced if you can share some experience with me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acupen_0-1733406538800.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1442437i931ECCA38C421AD4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="acupen_0-1733406538800.png" alt="acupen_0-1733406538800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 14:00:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13194950#M442</guid>
      <dc:creator>acupen</dc:creator>
      <dc:date>2024-12-05T14:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a key press  'Enter' in Python?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13195077#M443</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;pynput&lt;/STRONG&gt; package can be used to simulate keystrokes.&lt;/P&gt;&lt;P&gt;Here is a snipped code for the ENTER key:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pynput.keyboard import Key, Controller
keyboard = Controller()

keyboard.press(Key.enter)
keyboard.release(Key.enter)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder how are you going to trigger its execution: from where?&amp;nbsp; under which conditions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 14:56:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13195077#M443</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2024-12-05T14:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a key press  'Enter' in Python?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13196115#M444</link>
      <description>&lt;P&gt;Trigger a script you write in Fusion is easy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Run it as Add-Ins,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acupen_0-1733446293755.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1442713iD89418E0C489313F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="acupen_0-1733446293755.png" alt="acupen_0-1733446293755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. inside your add-ins, you write several commands. Then '&lt;STRONG&gt;&lt;EM&gt;Change Keyboard Shortcut...&lt;/EM&gt;&lt;/STRONG&gt;'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acupen_1-1733446394460.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1442714i4646648F5299519F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="acupen_1-1733446394460.png" alt="acupen_1-1733446394460.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. just assign a shortcut key for the command(underneath is a script) your write. Then it's done.&amp;nbsp;&lt;/P&gt;&lt;P&gt;During fusion running, every time you press 'g', you trigger your script once ...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acupen_2-1733446495000.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1442717iBC1C713275DD2678/image-size/medium?v=v2&amp;amp;px=400" role="button" title="acupen_2-1733446495000.png" alt="acupen_2-1733446495000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 00:57:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13196115#M444</guid>
      <dc:creator>acupen</dc:creator>
      <dc:date>2024-12-06T00:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a key press  'Enter' in Python?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13196125#M445</link>
      <description>&lt;P&gt;and Thanks for your reply.&lt;/P&gt;&lt;P&gt;I figure out a way to achieve what I want to do, beyond Fusion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just install a microsoft enhance tool:&amp;nbsp; &lt;STRONG&gt;PowerToys.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/microsoft/PowerToys/releases/tag/v0.86.0" target="_blank"&gt;https://github.com/microsoft/PowerToys/releases/tag/v0.86.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;then you can switch any keypress with other key in a system level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just switch the 'Space' key with 'Enter', everything is done now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for you help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 01:02:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13196125#M445</guid>
      <dc:creator>acupen</dc:creator>
      <dc:date>2024-12-06T01:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a key press  'Enter' in Python?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13679953#M21889</link>
      <description>&lt;P&gt;Guys I need help. I have to programm a game. I want to&amp;nbsp; define space bar. If someone klicks it, the timer should start counting. How do I do that? Please I need help!!&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 07:13:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-perform-a-key-press-enter-in-python/m-p/13679953#M21889</guid>
      <dc:creator>juji08</dc:creator>
      <dc:date>2025-06-13T07:13:44Z</dc:date>
    </item>
  </channel>
</rss>

