Jump to content

Recommended Posts

Posted

It's not, i've checked the txt file almost 20 times! The last line is 28/10/2011! Thank for your help, now I try on myself and I'll let you know, ok?

Posted (edited)

How about this?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <File.au3>

$Form1 = GUICreate("Territories", 477, 237, 192, 124)
$File = GUICtrlCreateMenu("&File")
$Exit = GUICtrlCreateMenuItem("E&xit", $File)
$Tools = GUICtrlCreateMenu("T&ools")
$OverTime = GUICtrlCreateMenuItem("Ch&eck expiration", $Tools)
GUISetState(@SW_SHOW)
Dim $Form1_AccelTable[2][2] = [["!x", $Exit],["^h", $OverTime]]
GUISetAccelerators($Form1_AccelTable)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Exit
        Exit
    Case $OverTime
        $file = FileOpen("C:Users\Utente\Documents\Date.txt")
        $AnyDate = FileReadLine($file,-1)
        FileClose($file)

        $TodayDate = _NowCalcDate()
        $AnyDate = StringMid($AnyDate, 7, 4) & "/" & StringMid($AnyDate, 4, 2) & "/" & StringMid($AnyDate, 1, 2)
        MsgBox(4096, "",  "Date read: " & $AnyDate & @CRLF & _
        "Today: " & _NowCalcDate() & @CRLF & _
        "Difference in days: " & _DateDiff("d", $AnyDate, $TodayDate) & @CRLF & _
        "Difference in months: " & _DateDiff("m", $AnyDate, $TodayDate))
    EndSwitch
WEnd
Edited by czardas
Posted (edited)

Did you know that AutoIt isn't case sensitive? That was the problem! If you see in the KODA GUI REGION you will see a variable, $File, that has the same name of our $file variable..

Thank you for all your time spent on this problem.. Thank you very much :D

Edited by Baster

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
×
×
  • Create New...