Case Sensitivity question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
obfusc88
Pro Scripter
Posts: 89
Joined: Wed Mar 14, 2007 6:22 pm

Case Sensitivity question

Post by obfusc88 » Wed Feb 04, 2009 5:20 am

I did the following script today

Code: Select all

Year>YYYY
Month>MM
Day>DD
Hour>>hh
Min>mm
Sec>ss
Let>Stamp=%YYYY%%MM%%DD%%hh%%mm%%ss%
I expected Stamp to come back as 20090202102037
But ic came back as 20092002102037

Then I realized that I was getting the minutes for the month.
So I did this

Code: Select all

Let>MM=02
Let<mm=20
I checked the watch list ond only saw MM=20!

---------------
I thought that variables were Case Sensitive, but I must be wrong? Is it only Labels/SRTs/Dialogs that are Case Sensitive?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Re: Case Sensitivity question

Post by jpuziano » Wed Feb 04, 2009 6:50 am

obfusc88 wrote:I thought that variables were Case Sensitive, but I must be wrong? Is it only Labels/SRTs/Dialogs that are Case Sensitive?
Clicking "Search" here on the forums and doing a Google type search for: "case sensitive" variables finds many posts on this however many of them say variables are case sensitive. This is incorrect or at the very least misleading.

Here's an out-take from an excellent post by JRL on case sensitivity:
  • Case sensitive items:
    - Variable values

    Case insensitive items:
    - User defined variable names
    - System variable names (Help singles out OS_VER, WIN_DIR, SYS_DIR and TEMP_DIR as variables that "store their values in upper case." However, testing these with version 9, all of them worked for me when typed in lower case.)
So in your case, MM and mm both refer to the same variable.

To see it in action:

- create the following new macro:

Code: Select all

Let>MM=02
Let>mm=20
MDL>done
- click the Watch List tab in the editor so it is open and you can watch the variables being created and assigned values

- make sure the cursor is positioned at the beginning of the first line

- click the Debug/Step tool bar icon or hit F8 to single step through the lines and watch as variables are created and assigned values

- you'll see it create a variable called MM and set its value to 02

- another F8 will show you that a new variable called mm is not created... it just updates the MM variable to 20

Side Note: I believe it still does not say anywhere in the Help File that user defined variable names are not case sensitive. Marcus if this has been added somewhere, please say where but if not, perhaps it would be a nice addition... and with an example would be best. As we can see from this post, it is something new people still learn the hard way.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts