Jump to content

Case sensitive variables question [SOLVED]


Recommended Posts

If you try below code:

Assign("Val",-45.961)
$sStr = "VAL: " & Eval("VAL") & @CRLF
$sStr &= "val: " & Eval("val") & @CRLF
$sStr &= "VaL: " & Eval("VaL")
MsgBox(32,"Variable",$sStr)

you can note that all results are the same.

I'd like to make case sensitive variables (I need this for some scripts), where VAL, val and VaL are different. It can be done with array functions, but it's slow and not smart. So I've a question. Is it possible to do this in any other way?

I'm waiting for an answer.

Edited by Shanheavel
Link to comment
Share on other sites

  • Moderators

Shanheaval,

I'd like to make case sensitive variables (I need this for some scripts)

Really? Can you give us an example? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers

You state you need case sensitive variable names but don't explain why.

So, could you shed some light as to why this would be needed?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I'm waiting for an answer.

?

This is no 24 hours support forum. It's not impossible that you wont't get an answer at all.

Have you checked the help file?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@Melba23 and Jos

I'd like to work with standard system functions, constants and structures. They're case sensitive.

@water

I know this isn't forum with 24/7 support, but it would be nice to get fast reply (like now :)).

I experimented with Assign, EnvSet, DllStructCreate etc. All of them are case insensitive .

Edited by Shanheavel
Link to comment
Share on other sites

  • Developers

Could be me but still missing your point.

Show me an example where Case sensitive variable names are an issue for you.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

AutoIt isn't case sensitive in regards to variable/function names. So, whatever it is that you think you need them for, AutoIt won't fit the bill. Although I greatly doubt you need case sensitive variable names, AFAIC I don't think any programming language NEEDS case sensitive variable names, nice to have, but it's almost never a need more than a want.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@Jos

I think we focused on the my point of view instead the problem. My English is hard to read, but I hope you can understand essence of my statements.

Returning to the topic, imagine that you've a list of USER32 library functions. From an ActivateKeyboardLayout to a wvsprintfW.

It looks something like this:

...
$MessageBeep = 0x7E431F7B
$MessageBoxA = 0x7E4507EA
...

and you want to assign the variable MESSAGEBOXA to 123. Of course, it'll fail, because you only overwrite the MessageBoxA.

This explain is good?

@czardas

I need to write my own preprocessor to AutoIt - closed source language? Is it a joke?

@BrewManNH

I didn't compare the amount, but I think the most programming language need case sensitive variable name (read C++ or FASM).

Link to comment
Share on other sites

@BrewManNH

I didn't compare the amount, but I think the most programming language need case sensitive variable name (read C++ or FASM).

No, they don't need them, they HAVE them, that is not the same thing. Just because they have them doesn't make it a need, it makes it something you have to remember to work around when naming variables. Anyone that states they NEED case sensitive variable names and can't explain in simple terms why they need them, obviously doesn't know what they're talking about.

I'm not saying that your lack of skill in the English language is an issue, but you haven't come up with a single reason why you think you need case sensitivity.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

As Jos pointed out, the OP needs to show an example of code that breaks because of case sensitivity.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I need to write my own preprocessor to AutoIt - closed source language? Is it a joke?

No it was not a joke. You know how you want the code to respond. Write the code to process the input before it is sent to the closed source interpreter. Why is that a joke? It might be easier to write the code differently. Like everyone else around here, I don't understand your reasons for wanting to use case sensitive variables. So it's the best answer I can offer.

Link to comment
Share on other sites

  • Moderators

Shanheaval,

I am loath to join in this procession of "WTF?" posts but your example:

$MessageBoxA = 0x7E4507EA
... and you want to assign the variable MESSAGEBOXA to 123

is the worst excuse I have seen here in nearly 5 years for claiming AutoIt has a problem. Let me offer some reasons why I have a real problem in treating your complaint as a serious failing in the language:

- 1. MESSAGEBOXA is not a valid AutoIt variable, so you fall at the first fence. :(

- 2. You decide what to call variables, not AutoIt, so why not use another name which does not depend on case-sensitivity? What forces you to use $MESSAGEBOXA (note the proper syntax) or $MessageBoxA as the name of a variable within your script? Why not change one of the names? There is a very good "search and replace" function in SciTE to amend existing code. ;)

- 3. You still have not shown us a valid sample of AutoIt code in which case-sensitivity is an issue. And until you do, I will treat your complaint with the contempt it frankly deserves. ;)

So, any advance from your side? Any actual code you can show us that needs case-sensitivity? :huh:

M23

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Writing preprocessor to other programming language isn't bad idea, but I just do it. So I can't write preprocessor to preprocessor, because it will very slow.

You all ask about code of example. I can say only that I'm making some "tool" written in AutoIt, which convert code in my format to FASM. Latter uses case-sensitivity, first not. And it's hard to bring together both for me, so I asked you. The only thing I came up with is something like this:

...
$aValName[3] = "MessageBoxA"
$aValData[3] = 0x7E4507EA
...
$aValName[34] = "MESSAGEBOXA"
$aValData[34] = "bla bla bla"
...
Link to comment
Share on other sites

  • Moderators

Shanheavel,

In that snippet you are using "MessageBoxA" and "MESSAGEBOXA" as literal strings which are case-sensitive in AutoIt, so I still fail to see how the case-insensitivity of AutoIt variables poses a problem. :wacko:

If you do come across a case please do let us know so that we can hep you resolve it - but were I a betting man my money would be on you never producing anything viable in which case-sensitivity poses insoluable difficulties. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I can't write preprocessor to preprocessor, because it will very slow.

I would say that depends on your method, and perhaps on the code content to a certain degree. How imperitive is it that you save half a second or even just a few miliseconds before the script runs? Anyway it seems superfluous to do this for anything other than an exercise. I suggest you think of a better alternative - one that's easy to code for.

Link to comment
Share on other sites

Brilliant!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Shanheavel

Assign(StringToBinary("VAL"),-45.961)
Assign(StringToBinary("val"), 34)
Assign(StringToBinary("VaL"),1)
$sStr = "VAL: " & Eval(StringToBinary("VAL")) & @CRLF
$sStr &= "val: " & Eval(StringToBinary("val")) & @CRLF
$sStr &= "VaL: " & Eval(StringToBinary("VaL"))
MsgBox(32,"Variable",$sStr)

And the winner is... AZJIO!

Exactly what I was looking for. I tested and it works. This is why I love this forum. If nobody has to add then I think we can close the thread.

Thanks!

Link to comment
Share on other sites

Assign(StringToBinary("VAL"),-45.961)
Assign(StringToBinary("val"), 34)
Assign(StringToBinary("VaL"),1)
$sStr = "VAL: " & Eval(StringToBinary("VAL")) & @CRLF
$sStr &= "val: " & Eval(StringToBinary("val")) & @CRLF
$sStr &= "VaL: " & Eval(StringToBinary("VaL"))
MsgBox(32,"Variable",$sStr)

Azijo haha: very tricky! :D Edited by czardas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...