Sign in to follow this  
Followers 0
mesale0077

date add code

3 posts in this topic

#include <Date.au3>

#include <GuiConstants.au3>

#include <file.au3>

#NoTrayIcon

$file = FileOpen("cdky.txt", 128)

If $file = -1 Then

cddd()

EndIf

$file = FileOpen("cdky.txt",0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in 1 character at a time until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Line read:", $line)

Wend

FileClose($file)

$Day1 =( @YEAR & $line )<------- add date problem(2009/06/28) like it ,but dont work

MsgBox(0, "Line read:", $Day1)

exit

If $CmdLine[0] = 0 Then

$Days = (_DateDiff("D", $Day1, _NowCalcDate() ))

IF $Days>0 then cdd()

ElseIf $CmdLine[0] = 1 Then

$Days =( _DateDiff("D", $Day1, _NowCalcDate() ) + $CmdLine[1])

if $Days > 365 then

$Days = $Days - 365

endif

IF $Days>0 then cdd()

EndIf

func cdd()

Opt("TrayIconHide", 1)

$var = DriveGetDrive( "CDROM" )

If not @error Then

For $i = 1 to $var[0]

CDTray($var[$i] , "open")

Next

EndIf

;CDTray("E:", "open")

;CDTray("E:", "closed")

ENDfunc

func cddd()

$a=InputBox("cd kill pro.","cd kill date (month/day)","06/28")

MsgBox(0, "Error", $a)

$file = FileOpen("autorun.inf", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine($file, "[autorun]")

FileWriteLine($file, "open=CDkill.exe" & @CRLF)

FileClose($file)

$file = FileOpen("cdky.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine($file, $a)

FileClose($file)

Exit

ENDfunc

good workes

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

; Read in 1 character at a time until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Line read:", $line)

Wend

FileClose($file)

$Day1 =( @YEAR & $line )<------- add date problem(2009/06/28) like it ,but dont work

MsgBox(0, "Line read:", $Day1)

exit

Not sure what you're asking, but if you're trying to add a date that looks like

"2009/06/28" by assigning same to a variable $Day1, then:

$day1 = @YEAR & "/" & @MON & "/" & @MDAY

or, if you'ld like the Atomic Clock Time:

AtomicDateTime Function

The UTC Date is in the format you want...

EDIT: JackDinn used almost identical words, just ahead of me... :)

Edited by vdot

[center][font="Tahoma"]What are all those clowns following me for?[/font][/center]

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