Empty Space In Variable Name

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Empty Space In Variable Name

01 Feb 2020, 15:23

Hi, I'm hoping this one is simple... can't find the answer to this. Is there a simple way to include an empty space in a variable name?

For example, this works:

Code: Select all

Gui 1: Add , Text, +cFFFFFF x10 y10 w100 h20 vMyVariable gClick, MyTest
but this one doesn't, because of the empty space between "My" and "Variable":

Code: Select all

Gui 1: Add , Text, +cFFFFFF x10 y10 w100 h20 vMy Variable gClick, MyTest
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Empty Space In Variable Name

01 Feb 2020, 15:28

variable name cant have space
Tcharr
Posts: 41
Joined: 25 Jan 2020, 15:38

Re: Empty Space In Variable Name

01 Feb 2020, 15:33

You might approximate a space in a variable name by using an underscore instead.

Example:

Code: Select all

Gui 1: Add , Text, +cFFFFFF x10 y10 w100 h20 vMy_Variable gClick, MyTest
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

01 Feb 2020, 15:48

ok yes, thanks. I was already using an underscore instead of an empty space. I was just hoping that I didn't have to do that, but it's no problem.

thanks again :)
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Empty Space In Variable Name

02 Feb 2020, 03:56

Hallo,
try:

Code: Select all

Ideographic Space := Chr(0x3000)
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

02 Feb 2020, 04:31

Code: Select all

Ideographic Space := Chr(0x3000)

msgbox, %Ideographic Space%


hi, i get an error message saying 'this line does not contain a recognized action'
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Empty Space In Variable Name

02 Feb 2020, 04:34

Here it works:

Code: Select all

Ideographic Space := Chr(0x3000)
MsgBox, %Ideographic Space%
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

02 Feb 2020, 04:37

still doesn't work here.

but when i save your code, i get the "warning" message regarding unicode characters... might that be something to do with it?
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Empty Space In Variable Name

02 Feb 2020, 04:44

Hallo,
try:

Code: Select all

MsgBox,% A_IsUnicode?"Unicode":"Ansi"
It should be Unicode! Your autohotkey should run as Unicode version, not Ansi!
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

02 Feb 2020, 04:47

Code: Select all

Ideographic Space := Chr(0x3000)
MsgBox,% A_IsUnicode?"Unicode":"Ansi"
now it says Error at Line 1, this line does not contain a recognized action:
Ideographic Space := Chr(0x3000)
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Empty Space In Variable Name

02 Feb 2020, 04:55

See:https://www.autohotkey.com/docs/Tutorial.htm#s11

During installation of AutoHotkey, you will be asked to choose from UNICODE or ANSI. In short, you would probably want to choose UNICODE. It has support for non-English letters and numbers (characters). Keep going until you see an Install button.

and choose UNICODE
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Empty Space In Variable Name

02 Feb 2020, 04:55

Is because the Rohwedder string contains a 00 and yours a 20 between Ideographic and Space
Temp00.png
Temp00.png (46.24 KiB) Viewed 1285 times
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

02 Feb 2020, 05:03

thank you guys-- i have to run to work now. let me check back on this after my shift... :)
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Empty Space In Variable Name

03 Feb 2020, 10:20

does this mean I should un-install my AHK and re-install using Unicode?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder, Thalon and 424 guests