Sign in to follow this  
Followers 0
Beukie

Get regional/local/user settings

5 posts in this topic

Hi,

 

Does anyone know a method how you can get Autoit to retreive OS (win XP and 7) settings such as timedate format, timezone, language etc.? Can't find any help on this topic...

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thanks AZJIO,

unfortunately the answer is not in that post. The reason why a I started this post is that I depend on an application that is depending on inputs from multiple stations among which are virtual stations.

If the timedate format from those stations is not alike the (external) application, all dates get corrupted where month and day can not be swapped, in cases where month and day can be swapped the record data is set wrong (e.g. June 1st (6/1) becomes january 6th (1/6))

Rebooting the uploading stations or updating the O.S. (various Win.) have shown the timedate format can be changed without the operator being aware.  

Since the application is an external application I can not add any input filter, But I can have all stations that send data have run an autorun exe at startup to check the timedate format. (Besides other measures we've taken, an extra layer of being certain all is set correct)

Edited by Beukie

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

edit: i must have missed your last paragraph - what you state there is a very bad idea. 1) it will not work, 2) it will cripple other functionality of your systems. if you must, force date format by group policy or such (i think even simple LGPO would do nicely). do not alter it on startup.

quit and dirty, if your application works with the "short date format":

this function will return 1 if system date format is DD/MM/YYYY

this function will return 2 if system date format is MM/DD/YYYY

you can adopt it to other formats as you see fit:

Func SysDateFormat()
    Local $s=_DateTimeFormat('2000/12/31',2)
    Switch StringLeft($s,2)
        Case '31'
            Return 1
        Case '12'
            Return 2
        Case Else
            Return 0
    EndSwitch
EndFunc
Edited by orbs

Share this post


Link to post
Share on other sites

I have interest in this subject, and have asked a few questions in the thread mentioned.

As far as I can see, your answer IS in the thread. timedate format, timezone, language etc  can all be retrieved from LCINFO.

You can try to adapt or simply define one format.

Definitions is always better as I see it, as there are many different combinations possible.


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0