Jump to content

Language independant AutoIt examples


water
 Share

Recommended Posts

I had a look at the _ExcelNumberFormat example to remove a bug (#2244) and noticed that the example didn't work on my german Office installation.

Should the AutoIt examples be written language independant so they work out of the box on every system?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

IMHO; language independence would be preferable but I guess that is up to the Devs.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If language independance is a must have, then I would look for a solution that works with Excel and remove the bug and add some language code to the example.

If it is just a nice to have, then I would only remove the bug for the time being.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

The example script uses $aFormatExamples[1] to $aFormatExamples[4] to format columns in Excel:

$aFormatExamples[5] = ["Format Examples", "General", "hh:mm:ss", "$#,##0.00", "[Red]($#,##0.00)"]

This is fine for systems with an english locale. For my german system this should be:

$aFormatExamples[5] = ["Format Examples", "Standard", "hh:mm:ss", "#.##0,00", "[Rot](#.##0,00)"]

What to do depends what the Devs intend with the example scripts.

If the examples should run on every system and return the desired result then some additional code might be needed to retrieve the correct settings.

If only english systems should be supported then the example scripts should check the locale and return a message that the results might be unexpected.

And the UDF function _ExcelNumberFormat should at least return an error if an invalid format is passed - which it doesn't do at the moment.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Err, why would you want to complicate an example by getting the correct currency format? Is that the example? No? Then why the fuck should the example contain it?

Examples should work in language neutral ways. If you find that in order to do that you need to add a bunch of extra code... re-think the example.

Link to comment
Share on other sites

IMHO the function should be renamed to _ExcelCellFormat because it not only formats numbers (but this would break compatibility so I think we'll have to live with the name).

Formatting numbers is language dependant (comma versus dot as decimal symbol and digit grouping symbol etc.). But it would need too much extra code to make the example language independant.

Hence I just added some error checking to display a MsgBox if the formatting string is invalid and added a remark to the UDF that the results might be invalid if a non english system is used.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Making code for excel language independent is really a nightmare, since native excel files can't even safely transfer from one region to another.

EDIT: This is actually not true (anymore). Excel formulas in xmlx format are stored in English format, as per my second link below. And apparently formulas in VBA works in en-US all the time, while the normal GUI works localized. Yet in version 2010 the VBA depends on the culture selected vs culture installed. So it's a complex topic with many aspecs and facets. Sorry for not checking up on this first time.. (but wondering what f.ex Excel in Arab or Hebrew may be like ? VBA r2l ?)

Formulas are localized, as are certain enumerations (like OP indicates).

There is a nice reference here

Some discussion of the matter here

Much about color in Excel

Seems like instead of "[Red]" you can use color index like "[Color45]". Although then I am not sure if that would be "[Farbe45]" in deDE version..

Edited by Myicq

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

Thanks a lot for this information. Explains a lot.

I think I will only create examples for english systems because the help file where the examples are embedded is written in english too.

Where there might be differences with other languages or even errors a message will inform the user.

Maybe I will even check the UI language and send a warning message to the user. Will have to think about this.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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

×
×
  • Create New...