Jump to content
Sign in to follow this  
jbennett

Compare date of file

Recommended Posts

jbennett

Hi everyone,

I've got this piece of code i'm playing with and wondering if someone could let me know how I can extend this so that after it adds a day to the date in the .ini it will then compare with current system date and it it's the same then a msgbox will display.

Any ideas?. Thanks very much

#include <Date.au3>

$input = iniread("test.ini","BACKUP","run_next?","")

$temp = StringRight($input,4) & "/" & StringMid($input,3,2) & "/" & StringLeft($input,2)
MsgBox(0, "", "Converted input date: " & $temp)

$output = _DateAdd('d', 1, $temp)

iniwrite("test.ini","BACKUP","run_next?",$output)

MsgBox(0, "", "Newly calculated date: " & $output & @CRLF & "(Or in case 0, error message: " & @error & " ) ")

Share this post


Link to post
Share on other sites
PsaltyDS

Hi everyone,

I've got this piece of code i'm playing with and wondering if someone could let me know how I can extend this so that after it adds a day to the date in the .ini it will then compare with current system date and it it's the same then a msgbox will display.

Any ideas?. Thanks very much

#include <Date.au3>

$input = iniread("test.ini","BACKUP","run_next?","")

$temp = StringRight($input,4) & "/" & StringMid($input,3,2) & "/" & StringLeft($input,2)
MsgBox(0, "", "Converted input date: " & $temp)

$output = _DateAdd('d', 1, $temp)

iniwrite("test.ini","BACKUP","run_next?",$output)

MsgBox(0, "", "Newly calculated date: " & $output & @CRLF & "(Or in case 0, error message: " & @error & " ) ")
I like your line of code for converting the date format... :mellow:

Compare your date with the return from _NowCalcDate():

If $output = _NowCalcDate() Then MsgBox(64, "Ta Da!", "Today's the day!")

:(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
jbennett

Hehe thanks

The only problem with my code is that it gets the date from the .ini file like this "20102008" and when I run the code it changes the date but then the next time I run it the code gets confused as it can't find "ddmmyyyy" as it's now "dd/mm/yyyy". Arghhh

Also to get my other code working I have to check if the system date is newer than the date in the .ini before doing anything else. All will be revealed shortly if I can just get over this last hurdle

Thanks

Edited by jbennett

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.