Page 1 of 1

Empty Space In Variable Name

Posted: 01 Feb 2020, 15:23
by scriptor2016
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

Re: Empty Space In Variable Name

Posted: 01 Feb 2020, 15:28
by AHKStudent
variable name cant have space

Re: Empty Space In Variable Name

Posted: 01 Feb 2020, 15:33
by Tcharr
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

Re: Empty Space In Variable Name

Posted: 01 Feb 2020, 15:48
by scriptor2016
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 :)

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 03:56
by Rohwedder
Hallo,
try:

Code: Select all

Ideographic Space := Chr(0x3000)

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:31
by scriptor2016

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'

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:34
by Rohwedder
Here it works:

Code: Select all

Ideographic Space := Chr(0x3000)
MsgBox, %Ideographic Space%

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:37
by scriptor2016
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?

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:44
by Rohwedder
Hallo,
try:

Code: Select all

MsgBox,% A_IsUnicode?"Unicode":"Ansi"
It should be Unicode! Your autohotkey should run as Unicode version, not Ansi!

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:47
by scriptor2016

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)

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:55
by Rohwedder
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

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 04:55
by Odlanir
Is because the Rohwedder string contains a 00 and yours a 20 between Ideographic and Space
Temp00.png
Temp00.png (46.24 KiB) Viewed 599 times

Re: Empty Space In Variable Name

Posted: 02 Feb 2020, 05:03
by scriptor2016
thank you guys-- i have to run to work now. let me check back on this after my shift... :)

Re: Empty Space In Variable Name

Posted: 03 Feb 2020, 10:20
by scriptor2016
does this mean I should un-install my AHK and re-install using Unicode?