Search code examples
autohotkeyhotkeys

How to send hotkey self when hotkey doesn't qualify in autohotkey2


I want to send the hot when the conditions are met, and send the hotkey itself when none of the conditions are met,like this:

^p:: {
    appName := GetappName()
    switch appName {
        case "Code":
            Send "^+p"
        default:
            Send "^p"
    }
    return
}

^n:: {
    appName := GetappName()
    switch appName {
        case "Obsidian":
            Send "!n"
        case "Code":
            Send "^!#n"
        default:
            Send "^n"
    }
    return
}

How is this code in default?


Solution

  • It has been solved, it can be used by switching back to #hotif, it didn't work because I swapped ctrl and caps with powertoys,now i can use $ or #hotif ,thanks