Case Sensitivity

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
DocTrinsOGrace
Posts: 7
Joined: 19 Mar 2024, 16:23

Case Sensitivity

21 Mar 2024, 17:59

I noticed in the forum ago sample scripts that some are case sensitive while others are not. So I see

Send "{Enter}"

and

send "{enter}"

This is confusing. Are variables case sensitive, or verbs, or keywords, or all of the above?

Thank you folks! You guys give great information.
gregster
Posts: 9035
Joined: 30 Sep 2013, 06:48

Re: Case Sensitivity

21 Mar 2024, 19:15

Function names and key names (like all the above), variable names, labels, window groups, classes, properties and methods are case-insensitive (at least for Ascii letters, for non-ascii letters see below). Afaics, case-sensitivity is only used moderately in AHK v1 and v2.

Yet Wintitles and string keys in v2 Map objects are case-sensitive by default, and probably other things where it is explicitly noted in the docs (for example, explicitly case-sensitive operators like == and !== versus their case-insensitive counterparts = and !=).

Other things like sorting or StrCompare can be made case-sensitive with certain non-default options.
Generally, a quick test or look into the docs can answer most questions, if in doubt.

About names in general:
https://www.autohotkey.com/docs/v2/Concepts.htm#names wrote: Case sensitivity: None for ASCII characters. For example, CurrentDate is the same as currentdate. However, uppercase non-ASCII characters such as 'Ä' are not considered equal to their lowercase counterparts, regardless of the current user's locale. This helps the script to behave consistently across multiple locales.
PS: Please don't post the same message several times. As a new user, you are required to wait until your posts get approved. Please be patient if this takes some time. Thank you!
User avatar
mikeyww
Posts: 26973
Joined: 09 Sep 2014, 18:38

Re: Case Sensitivity

21 Mar 2024, 19:57

I would like to clarify that only the window title of a WinTitle is case-sensitive. In addition, regular expressions are always case-sensitive by default unless specified otherwise.
gregster
Posts: 9035
Joined: 30 Sep 2013, 06:48

Re: Case Sensitivity

21 Mar 2024, 20:01

@mikeyww, good point. Thank you :thumbup:
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Case Sensitivity

22 Mar 2024, 05:43

mikeyww wrote:I would like to clarify that only the window title of a WinTitle is case-sensitive.
ahk_class is also case-sensitive, even without RegEx.
User avatar
mikeyww
Posts: 26973
Joined: 09 Sep 2014, 18:38

Re: Case Sensitivity

22 Mar 2024, 05:55

I stand corrected! Never knew that. I am adding a suggestion to the documentation board for this information to be added.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: alawsareps, aleksbor, Descolada, reborn, vmech and 132 guests