Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:32:17+00:00 2026-06-17T18:32:17+00:00

My Code is below.Whenever I try to run it I get an error saying

  • 0

My Code is below.Whenever I try to run it I get an error saying I’m using duplicate hotkeys when in practice they would never interfere with each other. How do I get around this?

“Your post does not have much context to explain the code sections; please explain your scenario more clearly.”. So I guess need to explain my code.. It’s extremely simple I have a state variable that is changed by pressing the arrow keys, then I have if statements that checks what the state is. If I press numpad1 when state = “up” the script should type “A”, if the state = “right” it would print I. However I’m getting an error since I used the same hotkey multiple times in my different if statements.

state := "none"
UP::
state := "up"
Right::
state := "right"
DOWN::
state := "down"
LEFT::
state := "left"

if (state = "up"){
Numpad1::
Send A
Return
Numpad2::
Send B
Return
Numpad3::
Send C
Return
Numpad4::
Send D
Return
Numpad6::
Send E
Return
Numpad7::
Send F
Return
Numpad8::
Send G
Return
Numpad9::
Send H
Return
}

if (sate = "right"){
Numpad1::
Send I
Return
Numpad2::
Send J
Return
Numpad3::
Send K
Return
Numpad4::
Send L
Return
Numpad6::
Send M
Return
Numpad7::
Send N
Return
Numpad8::
Send O
Return
Numpad9::
Send P
Return
}

if (state = "down"){
Numpad1::
Send Q
Return
Numpad2::
Send R
Return
Numpad3::
Send S
Return
Numpad4::
Send T
Return
Numpad6::
Send U
Return
Numpad7::
Send V
Return
Numpad8::
Send W
Return
Numpad9::
Send X
Return
}

if (state = "left"){
Numpad1::
Send Y
Return
Numpad2::
Send Z
Return
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:32:19+00:00Added an answer on June 17, 2026 at 6:32 pm

    When you use AHK_L, you can use #IF with multiple definitions of the same hotkey. WARNING this does NOT work with the regular AHK version.

    Here is an example.
    You set the variables by typing none\ right\ or left\ .
    Depending on the variable setting your Tab key will either send NORMAL, LEFT or RIGHT.

    #SingleInstance Force
    
    Tab::Send, NORMAL
    
    #if (state = "left")
        Tab::Send, LEFT
    #if ; End #if (state = "left")
    
    #if (state = "right")
        Tab::Send, RIGHT
    #if ; End #if (state = "right")
    
    :*:right\::
        state := "right"
    Return
    
    :*:left\::
        state := "left"
    Return
    
    :*:none\::
        state := "none"
    Return
    

    Alternatively, with the normal AHK, you define ONE hotkey and place IF statements inside the hotkeys to change the behaviour based on the state variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code (below) working just fine, however whenever I try to 'wrap'
The problem I am facing with below code is that whenever I try to
Help me! Whenever I try to start up the code below, it shows only
Whenever I try and get the InnerText of an element using an XmlDocument, it
I get the above error whenever I try and use ActionLink ? I've only
i am having a problem with the below code , it whenever i would
As a PHP developer, I always use the code below whenever I want to
I'm working on a word-press theme and whenever I add the code below to,
This code below allows me to find the word error in all my files
The code below fails on the line: Class.forName(oracle.jdbc.driver.OracleDriver); with the error: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.