Help using variables and expressions

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Help using variables and expressions

21 Oct 2018, 13:26

This works fine for me.

F4::
Computer = 1
Return

F5::
Computer = 2
Return

F6::
NumPad = 1
Return

F7::
NumPad = 2
Return


#If (NumPad = 1) & (Computer = 1)
=::
Soundbeep
Soundbeep
Return
#If


#If (NumPad = 2) & (Computer = 1)
=::
Soundbeep
Return
#If


To make the script easier to understand I tried this and it does not work.


F4::
Computer := Laptop
Return

F5::
Computer := Desktop
Return

F6::
NumPad := F6
Return

F7::
NumPad := F7
Return


#If (Computer = Laptop) & (NumPad = F6)
=::
Soundbeep
Soundbeep
Return
#If

#If (Computer = Laptop) & (NumPad = F7)
=::
Soundbeep
Return
#If

It does work if I only convert "computer" to a expression but when I also convert "NumPad" it stops working. Thanks
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Help using variables and expressions

21 Oct 2018, 13:30

Code: Select all

F4::
Computer := "Laptop"
Return

F5::
Computer := "Desktop"
Return

F6:: 
NumPad := "F6"
Return

F7::
NumPad := "F7"
Return


#If (Computer = "Laptop") & (NumPad = "F6") 
=::
Soundbeep
Soundbeep
Return
#If

#If (Computer = "Laptop") & (NumPad = "F7") 
=::
Soundbeep
Return
#If
https://autohotkey.com/docs/Language.htm#expressions
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Re: Help using variables and expressions

21 Oct 2018, 13:47

Thank-You! That did it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Joey5, RandomBoy and 361 guests