Skip to content

[notes] about #if and Hotkey, If , ExpressionΒ #89

@CoffeeChaton

Description

@CoffeeChaton

Feat Provide

πŸ”Ž Search keywords

forums https://www.autohotkey.com/boards/viewtopic.php?f=76&t=130812&p=575849#p575849
Hotkey,If, Expression https://www.autohotkey.com/docs/v1/lib/Hotkey.htm#If

πŸ’» Exp Code

#Requires AutoHotkey v1.1.33.11
#SingleInstance Force
#Warn All, MsgBox

global x := "`t"

Hotkey, If, x = "`t" ;#1
Hotkey, F2, foo1, On

Hotkey, If, % "x = """ A_Tab """" ; #3 .eq. x = "\t" case ...
Hotkey, F3, foo2, On

Hotkey, If, true
Hotkey, F11, foo_set_space, On
Hotkey, F12, foo_set_t, On

#If x = "`t" ;#2
#if true

foo1() {
    MsgBox, 1
}

foo2() {
    MsgBox, 222
}

foo_set_space() {
    x := "`t"
    MsgBox, % "x is tab"
}
foo_set_t() {
    x := A_Space
    MsgBox, % "x is space"
}

like it

#Requires AutoHotkey v1.1.33.11
#SingleInstance Force
#Warn All, MsgBox

global x := "`t"

#If x = "`t"
~F2:: foo1()
~F3:: foo2()

#if true
~F11:: foo_set_space()
~F12:: foo_set_t()
 foo1() {
    MsgBox, 1
}

foo2() {
    MsgBox, 222
}

foo_set_space() {
    x := "`t"
    MsgBox, % "x is tab"
}
foo_set_t() {
    x := A_Space
    MsgBox, % "x is space"
}

Research

  1. #1 should text equal #2 , and not allowed variations.
  2. #3 after translation should text equal #2 , and not allowed variations.

exp:

  1. if #2 look like #If x = "t"`
  2. then #1 should be Hotkey, If, x = "t"`
  3. and #3 should be Hotkey, If, % "x = """ A_Tab """"

A guess is that although #if accepts expressions later, when Hotkey, If, searches, it is obtained directly from the .ahk file without any changes. Maybe this can provide higher performance?

Or is it just better to implement?

...I'm not interested in the internal implementation of ahk, but I am interested in grammar and completion, but I haven't figured out how to implement it yet.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions