Jump to content
Sign in to follow this  
Merlin1968

Get time and date values

Recommended Posts

Merlin1968

Hello everyone. Newbie here. Newbie to programming as well as AutoIt, so please be gentle. I've been playing around with version 3 for several weeks now, and it's definitely going to make my sysadmin responsibilities much easier and more efficient.

So I've been working on this project for days now, and I can't seem to find the correct code. I've searched through the forums, as well as the help.chm, and I'm coming up blank.

A little background... I manage our voice and data infrastructure. My pbx is programmed via hyperterminal, and since the pbx doesn't have an SNTP feature, I manually have to adjust the time every few months. Don't even ask about DST... it's a great pbx, but has some annoying traits.

Anyway, here's what I would like to do:

1. synch up my computer with my network's NTP server.

Easy to do with "RunWait(@ComSpec & " /c net time /set /yes")"

2. Establish a hyperterminal session with the pbx via analog modem.

ShellExecute("C:\Documents and Settings\jsmith\Desktop\Admin tools\pbx.ht")

3. Send values for date and time. The problem here is that each value (month, day, year, hour, minute) are discrete separate values. So I'll have to send "1" when the switch prompts for the month, "17" when it prompts for the day, etc.

I've been looking at "_GUICtrlDTP_GetSystemTime " but again, my newbie disability is getting in the way. I see the code, but I can't seem to understand it, nor how I can modify it to achieve my goal. Any advice on how I can do this? thanks for the help in advance.

Share this post


Link to post
Share on other sites
GEOSoft

Hello everyone. Newbie here. Newbie to programming as well as AutoIt, so please be gentle. I've been playing around with version 3 for several weeks now, and it's definitely going to make my sysadmin responsibilities much easier and more efficient.

So I've been working on this project for days now, and I can't seem to find the correct code. I've searched through the forums, as well as the help.chm, and I'm coming up blank.

A little background... I manage our voice and data infrastructure. My pbx is programmed via hyperterminal, and since the pbx doesn't have an SNTP feature, I manually have to adjust the time every few months. Don't even ask about DST... it's a great pbx, but has some annoying traits.

Anyway, here's what I would like to do:

1. synch up my computer with my network's NTP server.

Easy to do with "RunWait(@ComSpec & " /c net time /set /yes")"

2. Establish a hyperterminal session with the pbx via analog modem.

ShellExecute("C:\Documents and Settings\jsmith\Desktop\Admin tools\pbx.ht")

3. Send values for date and time. The problem here is that each value (month, day, year, hour, minute) are discrete separate values. So I'll have to send "1" when the switch prompts for the month, "17" when it prompts for the day, etc.

I've been looking at "_GUICtrlDTP_GetSystemTime " but again, my newbie disability is getting in the way. I see the code, but I can't seem to understand it, nor how I can modify it to achieve my goal. Any advice on how I can do this? thanks for the help in advance.

You shouldn't need that function to do what you want. What you should be looking at is the Date and Time Macros in the help file.

for example when you are prompted for the month, you want to send @Mon or for day it would be @MDay


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!"

Share this post


Link to post
Share on other sites
BigDod

Lookup

@SEC

Seconds value of clock. Range is 00 to 59

@MIN

Minutes value of clock. Range is 00 to 59

@HOUR

Hours value of clock in 24-hour format. Range is 00 to 23

@MDAY

Current day of month. Range is 01 to 31

@MON

Current month. Range is 01 to 12

@YEAR

Current four-digit year

@WDAY

Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday.

@YDAY

Current day of year. Range is 1 to 366 (or 365 if not a leap year)

from the help file


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites
Merlin1968

seriously??? it's that easy?? wow, do I feel like a dumb ass... thanks for the feedback, and I'll give it a shot.

<Wanders off, scratching head, muttering "I know I looked at that before....">

Share this post


Link to post
Share on other sites
GEOSoft

seriously??? it's that easy?? wow, do I feel like a dumb ass... thanks for the feedback, and I'll give it a shot.

<Wanders off, scratching head, muttering "I know I looked at that before....">

Just takes a while to catch on.

Depending on where you are entering the string, there are also a few functions that you could look at instead of Send() as well.


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!"

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  

×