mesale0077 Posted May 28, 2009 Share Posted May 28, 2009 #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 Link to comment Share on other sites More sharing options...
JackDinn Posted May 28, 2009 Share Posted May 28, 2009 not 100% sure what your asking but $Day1 = @YEAR & "/" & @MON & "/" & @MDAY & " " & $line will add the date to the beginning of $line Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
vdo Posted May 28, 2009 Share Posted May 28, 2009 (edited) ; Read in 1 character at a time until the EOF is reachedWhile 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line)WendFileClose($file)$Day1 =( @YEAR & $line )<------- add date problem(2009/06/28) like it ,but dont workMsgBox(0, "Line read:", $Day1)exitNot 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 & "/" & @MDAYor, if you'ld like the Atomic Clock Time:AtomicDateTime FunctionThe UTC Date is in the format you want...EDIT: JackDinn used almost identical words, just ahead of me... Edited May 28, 2009 by vdot [center][font="Tahoma"]What are all those clowns following me for?[/font][/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now