Ignore All Hotkeys AutoHotKey











up vote
0
down vote

favorite












CODE



currentstring := ""
q::
ExitApp
return
w::
MsgBox,,,Hello`, World!,3
return
e::
MsgBox,,,Hello World,3
return
r::
InputBox, currentstring
*::
return
return
t::
MsgBox,,,%currentstring%,3
return


But when I am in the InputBox and I press q,w,e,r, or t, it executes the code before the return, even though I already override the hotkeys by *::.



Is there any fix to this?










share|improve this question


























    up vote
    0
    down vote

    favorite












    CODE



    currentstring := ""
    q::
    ExitApp
    return
    w::
    MsgBox,,,Hello`, World!,3
    return
    e::
    MsgBox,,,Hello World,3
    return
    r::
    InputBox, currentstring
    *::
    return
    return
    t::
    MsgBox,,,%currentstring%,3
    return


    But when I am in the InputBox and I press q,w,e,r, or t, it executes the code before the return, even though I already override the hotkeys by *::.



    Is there any fix to this?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      CODE



      currentstring := ""
      q::
      ExitApp
      return
      w::
      MsgBox,,,Hello`, World!,3
      return
      e::
      MsgBox,,,Hello World,3
      return
      r::
      InputBox, currentstring
      *::
      return
      return
      t::
      MsgBox,,,%currentstring%,3
      return


      But when I am in the InputBox and I press q,w,e,r, or t, it executes the code before the return, even though I already override the hotkeys by *::.



      Is there any fix to this?










      share|improve this question













      CODE



      currentstring := ""
      q::
      ExitApp
      return
      w::
      MsgBox,,,Hello`, World!,3
      return
      e::
      MsgBox,,,Hello World,3
      return
      r::
      InputBox, currentstring
      *::
      return
      return
      t::
      MsgBox,,,%currentstring%,3
      return


      But when I am in the InputBox and I press q,w,e,r, or t, it executes the code before the return, even though I already override the hotkeys by *::.



      Is there any fix to this?







      autohotkey






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      MilkyWay90

      7610




      7610
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          *:: is not a "catch all" hotkey, it just fires when it detects an asterisk (normally Shift+8).



          To achieve your desired effect, you should activate the hotkeys based on the active window.



          Working Example



          If the active window is an InputBox (ahk_class #32270), disable the hotkeys, but don't block their native function (the ~ prefix). If not the InputBox, bind the hotkeys as desired.



          #SingleInstance force
          currentstring := ""
          return ; end auto-execute section

          #IfWinActive, ahk_class #32770 ; If an InputBox window, restore default key function
          ~q::
          ~w::
          ~e::
          ~r::
          ~t::
          return

          #IfWinActive ; If anything else
          q::
          ExitApp
          return
          w::
          MsgBox,,,Hello`, World!,3
          return
          e::
          MsgBox,,,Hello World,3
          return
          r::
          InputBox, currentstring
          return
          t::
          MsgBox,,,%currentstring%,3
          return


          Notes:




          • It is considered best practice to only bind the hotkeys you need, not to everything.

          • To determine a Window's properties (class, id, etc.), you can use the Active Window Info or Window Spy tool bundled with AutoHotKey. It can also be launched from the system tray icon of a running script if Menu, Tray, NoStandard has not been used.






          share|improve this answer





















          • Thank you! What does #SingleInstance force do?
            – MilkyWay90
            2 days ago










          • Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
            – samthecodingman
            2 days ago










          • Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
            – MilkyWay90
            11 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418059%2fignore-all-hotkeys-autohotkey%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          *:: is not a "catch all" hotkey, it just fires when it detects an asterisk (normally Shift+8).



          To achieve your desired effect, you should activate the hotkeys based on the active window.



          Working Example



          If the active window is an InputBox (ahk_class #32270), disable the hotkeys, but don't block their native function (the ~ prefix). If not the InputBox, bind the hotkeys as desired.



          #SingleInstance force
          currentstring := ""
          return ; end auto-execute section

          #IfWinActive, ahk_class #32770 ; If an InputBox window, restore default key function
          ~q::
          ~w::
          ~e::
          ~r::
          ~t::
          return

          #IfWinActive ; If anything else
          q::
          ExitApp
          return
          w::
          MsgBox,,,Hello`, World!,3
          return
          e::
          MsgBox,,,Hello World,3
          return
          r::
          InputBox, currentstring
          return
          t::
          MsgBox,,,%currentstring%,3
          return


          Notes:




          • It is considered best practice to only bind the hotkeys you need, not to everything.

          • To determine a Window's properties (class, id, etc.), you can use the Active Window Info or Window Spy tool bundled with AutoHotKey. It can also be launched from the system tray icon of a running script if Menu, Tray, NoStandard has not been used.






          share|improve this answer





















          • Thank you! What does #SingleInstance force do?
            – MilkyWay90
            2 days ago










          • Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
            – samthecodingman
            2 days ago










          • Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
            – MilkyWay90
            11 hours ago















          up vote
          0
          down vote



          accepted










          *:: is not a "catch all" hotkey, it just fires when it detects an asterisk (normally Shift+8).



          To achieve your desired effect, you should activate the hotkeys based on the active window.



          Working Example



          If the active window is an InputBox (ahk_class #32270), disable the hotkeys, but don't block their native function (the ~ prefix). If not the InputBox, bind the hotkeys as desired.



          #SingleInstance force
          currentstring := ""
          return ; end auto-execute section

          #IfWinActive, ahk_class #32770 ; If an InputBox window, restore default key function
          ~q::
          ~w::
          ~e::
          ~r::
          ~t::
          return

          #IfWinActive ; If anything else
          q::
          ExitApp
          return
          w::
          MsgBox,,,Hello`, World!,3
          return
          e::
          MsgBox,,,Hello World,3
          return
          r::
          InputBox, currentstring
          return
          t::
          MsgBox,,,%currentstring%,3
          return


          Notes:




          • It is considered best practice to only bind the hotkeys you need, not to everything.

          • To determine a Window's properties (class, id, etc.), you can use the Active Window Info or Window Spy tool bundled with AutoHotKey. It can also be launched from the system tray icon of a running script if Menu, Tray, NoStandard has not been used.






          share|improve this answer





















          • Thank you! What does #SingleInstance force do?
            – MilkyWay90
            2 days ago










          • Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
            – samthecodingman
            2 days ago










          • Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
            – MilkyWay90
            11 hours ago













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          *:: is not a "catch all" hotkey, it just fires when it detects an asterisk (normally Shift+8).



          To achieve your desired effect, you should activate the hotkeys based on the active window.



          Working Example



          If the active window is an InputBox (ahk_class #32270), disable the hotkeys, but don't block their native function (the ~ prefix). If not the InputBox, bind the hotkeys as desired.



          #SingleInstance force
          currentstring := ""
          return ; end auto-execute section

          #IfWinActive, ahk_class #32770 ; If an InputBox window, restore default key function
          ~q::
          ~w::
          ~e::
          ~r::
          ~t::
          return

          #IfWinActive ; If anything else
          q::
          ExitApp
          return
          w::
          MsgBox,,,Hello`, World!,3
          return
          e::
          MsgBox,,,Hello World,3
          return
          r::
          InputBox, currentstring
          return
          t::
          MsgBox,,,%currentstring%,3
          return


          Notes:




          • It is considered best practice to only bind the hotkeys you need, not to everything.

          • To determine a Window's properties (class, id, etc.), you can use the Active Window Info or Window Spy tool bundled with AutoHotKey. It can also be launched from the system tray icon of a running script if Menu, Tray, NoStandard has not been used.






          share|improve this answer












          *:: is not a "catch all" hotkey, it just fires when it detects an asterisk (normally Shift+8).



          To achieve your desired effect, you should activate the hotkeys based on the active window.



          Working Example



          If the active window is an InputBox (ahk_class #32270), disable the hotkeys, but don't block their native function (the ~ prefix). If not the InputBox, bind the hotkeys as desired.



          #SingleInstance force
          currentstring := ""
          return ; end auto-execute section

          #IfWinActive, ahk_class #32770 ; If an InputBox window, restore default key function
          ~q::
          ~w::
          ~e::
          ~r::
          ~t::
          return

          #IfWinActive ; If anything else
          q::
          ExitApp
          return
          w::
          MsgBox,,,Hello`, World!,3
          return
          e::
          MsgBox,,,Hello World,3
          return
          r::
          InputBox, currentstring
          return
          t::
          MsgBox,,,%currentstring%,3
          return


          Notes:




          • It is considered best practice to only bind the hotkeys you need, not to everything.

          • To determine a Window's properties (class, id, etc.), you can use the Active Window Info or Window Spy tool bundled with AutoHotKey. It can also be launched from the system tray icon of a running script if Menu, Tray, NoStandard has not been used.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          samthecodingman

          1,224813




          1,224813












          • Thank you! What does #SingleInstance force do?
            – MilkyWay90
            2 days ago










          • Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
            – samthecodingman
            2 days ago










          • Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
            – MilkyWay90
            11 hours ago


















          • Thank you! What does #SingleInstance force do?
            – MilkyWay90
            2 days ago










          • Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
            – samthecodingman
            2 days ago










          • Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
            – MilkyWay90
            11 hours ago
















          Thank you! What does #SingleInstance force do?
          – MilkyWay90
          2 days ago




          Thank you! What does #SingleInstance force do?
          – MilkyWay90
          2 days ago












          Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
          – samthecodingman
          2 days ago




          Makes sure that only one of this program is running at a time. By default whenever I'm working with hotkeys it's useful to make sure you've only got one version running at a time. #SingleInstance
          – samthecodingman
          2 days ago












          Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
          – MilkyWay90
          11 hours ago




          Okay! Normally it just gives a warning and I shut down the older instance. Thanks for the tip, though!
          – MilkyWay90
          11 hours ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418059%2fignore-all-hotkeys-autohotkey%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          What visual should I use to simply compare current year value vs last year in Power BI desktop

          How to ignore python UserWarning in pytest?

          Alexandru Averescu