StringcaseSense, Variables and parsing problem

Get help with using AutoHotkey and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 710
Joined: 29 Sep 2013, 22:18

StringcaseSense, Variables and parsing problem

11 Feb 2019, 20:05

I want to be able to create variables in upper and lower case. I thought stringcasesense would help but so far what I have doesn't work:

Code: Select all

StringCaseSense, on

H := "HELLO WORLD!"
h := "hello world!"

test := "Hh"
loop, parse, test
{
	line := A_loopfield ": " %A_loopfield%
	msgbox, %line%
}
I'm only seeing "hello world!". Can someone please help so both variables display? Thanks.
User avatar
jeeswg
Posts: 6125
Joined: 19 Dec 2016, 01:58
Location: UK

Re: StringcaseSense, Variables and parsing problem

11 Feb 2019, 20:33

Variables in AutoHotkey are case insensitive. So H and h are the same variable.

Code: Select all

H := "HELLO WORLD!"
h := "hello world!"
MsgBox, % H "`r`n" h
Here's a workaround:

Code: Select all

oDict := ComObjCreate("Scripting.Dictionary")
oDict.Item("H") := "HELLO WORLD!"
oDict.Item("h") := "hello world!"
MsgBox, % oDict.Item("H") "`r`n" oDict.Item("h")
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
PuzzledGreatly
Posts: 710
Joined: 29 Sep 2013, 22:18

Re: StringcaseSense, Variables and parsing problem

23 Feb 2019, 20:26

Thanks, finally had time to look at this and I got it working.

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Leli196 and 238 guests