AntiVirusGuy Posted May 20, 2006 Share Posted May 20, 2006 how do I take the string "20060519" and make it "2006/05/19" lets assume the first line is $date how do I make $fdate (formatted date) Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 (edited) i thought you already did that... from your other post $t=$n_Fdate[0] & "/" & $n_Fdate[1] & "/" & $n_Fdate[2] that should be right my effort $file = "XPClean-Menu.exe" #include<date.au3> $t = FileGetTime($file, 1) If Not @error Then $startdate = $t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5] If _DateDiff("D", $startdate, _NowCalc()) > 30 Then MsgBox(0, "*XPClean Menu*", "Your registration period has expired.") Exit EndIf Else $ans = _DateDiff("D", $startdate, _NowCalc()) MsgBox(0, $ans & " days", _NowCalc() & @CRLF & $startdate) EndIf 8) Edited May 20, 2006 by Valuater Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 two seperate problems in this situation I am pulling this date from a dat file and I need to formate it so I can calculate ithow do I take the string "20060519"and make it "2006/05/19"lets assume the first line is $date how do I make $fdate (formatted date) Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 two seperate problems in this situation I am pulling this date from a dat file and I need to formate it so I can calculate it$file = "My-File.dat"with the script abovewhy does this not work... what 3 problems?????8) Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 (edited) I am pulling the date of the dat file from with in the dat file, in other words when the manufacture of the product released it this is what I came up with I am not surre if I could have done this in 1 line I am just starting with strings $defy = StringMid ( $def2, 1, 4 ) $defm = StringMid ( $def2, 5, 2) $defd = StringMid ( $def2, 7, 2 ) $deff = $defy & "/" & $defm & "/" & $defd I do have one other question how do I compare the two dates and then display how many days old the difference is Edited May 20, 2006 by ssebrownatcolby Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 I am pulling the date of the dat file from with in the dat file, in other words when the manufacture of the product released it this is what I came up with I am not surre if I could have done this in 1 line I am just starting with strings$defy = StringMid ( $def2, 1, 4 )$defm = StringMid ( $def2, 5, 2)$defd = StringMid ( $def2, 7, 2 )$deff = $defy & "/" & $defm & "/" & $defdcan you show me 1 or 2 lines from the dat file... then i can figure out how best to get that infoI do have one other question how do I compare the two dates and then display how many days old the difference isthats what i have answered with the script i gave you8) Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 (edited) Sorry dumb question on the date calc I think I have been up to long. I retreaved the dat def into a simple variable called $defs so defs = 20060519 I really wish there was a book to read so much I don't understand not having any programming background like when people use a -1 in a string statemnt what does that do?another thing I was pondering how do I get the first dat version and date on this page, they change daily I just want the latest top onehttp://www.nod32.com/support/updates.php Edited May 20, 2006 by ssebrownatcolby Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 this will get the version and the date requires IE.au3 in the beta\include folder Taken from lesson in "Welcome to Autoit 1-2-3" expandcollapse popup; demonstration to find chracters that change between to standard points ; or just find a string #include <IE.au3> #Region --- IE-Builder generated code Start --- $oIE = _IECreate () ;------------- User input -------------- _IENavigate ($oIE, "http://www.nod32.com/support/updates.php") ; web address $Find = "<!---BEGIN_VERSION--->" ; my info shows after this line... or just find this line $Before = "<!---END_VERSION--->" ; my info shows before this line... or set as "" $Find2 = "<!---BEGIN_DATE--->" ; my info shows after this line... or just find this line $Before2 = ")</" ; my info shows before this line... or set as "" ; ------------ End User input ------------- Sleep(1000) $body = _IEBodyReadHTML ($oIE) $sloc = @TempDir & "\stest.txt" FileDelete($sloc) FileWrite($sloc, $body) $sfile = FileOpen($sloc, 0) $num = 0 While 2 $num = $num + 1 $sline = FileReadLine($sfile, $num) If @error Then MsgBox(262208, "Fail", "The string was NOT found ") FileClose($sfile) Exit EndIf If StringInStr($sline, $Find) Then ;MsgBox(64, "Success", "The string " & $Find & " was found " & @CRLF & " on line # " & $num, 5) If $Before = "" Then ExitLoop $Found = stringbetween($sline, $Find, $Before) MsgBox(64, "Found", "Version is v" & $Found & " ", 5) ;ExitLoop EndIf If StringInStr($sline, $Find2) Then ;MsgBox(64, "Success", "The string " & $Find2 & " was found " & @CRLF & " on line # " & $num, 5) If $Before2 = "" Then ExitLoop $Found = stringbetween($sline, $Find2, $Before2) $t = StringSplit($Found, "") $Found = $t[1] & $t[2] & $t[3] & $t[4] & "/" & $t[5] & $t[6] & "/" & $t[7] & $t[8] ; & " " & $t[3] & ":" & $t[4] & ":" & $t[5] MsgBox(64, "Found", "The date is " & $Found & " ", 5) ExitLoop EndIf WEnd Func stringbetween($str, $start, $end) $pos = StringInStr($str, $start) If Not @error Then $str = StringTrimLeft($str, $pos + StringLen($start) - 1) $pos = StringInStr($str, $end) If Not @error Then $str = StringTrimRight($str, StringLen($str) - $pos + 1) Return $str EndIf EndIf EndFunc ;==>stringbetween #EndRegion --- IE-Builder generated code End --- 8) Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 Thanks your the best! I downloaded the latest beta last night "autoit-v3.1.1.124-beta-Setup.exe" It did not install ie.au3 in the include folder so I am getting errors I will have to find it Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 (edited) Thanks your the best! I downloaded the latest beta last night "autoit-v3.1.1.124-beta-Setup.exe"It did not install ie.au3 in the include folder so I am getting errors I will have to find itits herehttp://www.autoitscript.com/forum/index.ph...pe=post&id=8670save that as IE.au3 and in the Beta\Include folder8) Edited May 20, 2006 by Valuater Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 I am getting these errors ERROR: SetError() [built-in] called with wrong number of args. If @error Then Return SetError(@error, @extended, 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ERROR: SetError() [built-in] called with wrong number of args. Return SetError(@error, @extended, 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ERROR: undefined macro. $IEComErrorComObj = @COM_EventObj ~~~~~~~~~~~~~~~~~~~~^ defs find.au3 - 3 error(s), 0 warning(s) Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 I am getting these errors ERROR: SetError() [built-in] called with wrong number of args. If @error Then Return SetError(@error, @extended, 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ERROR: SetError() [built-in] called with wrong number of args. Return SetError(@error, @extended, 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ERROR: undefined macro. $IEComErrorComObj = @COM_EventObj ~~~~~~~~~~~~~~~~~~~~^ defs find.au3 - 3 error(s), 0 warning(s) you need the beta version of Autoit http://www.autoitscript.com/forum/index.php?showtopic=19717# .. then make sure you press... in SciTE Tools > Run Beta 8) Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 (edited) I did I have autoit-v3.1.1.124-beta-Setup.exe and pressed run beta oups scitie does not know about this I just had to hit continue is there anyway to hide the ie window? You have been a great help BIG THANKS this is why I donte to autoit ...great stuff Edited May 20, 2006 by ssebrownatcolby Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 I did I have autoit-v3.1.1.124-beta-Setup.exe and pressed run beta oups scitie does not know about this I just had to hit continueis there anyway to hide the ie window?You have been a great help BIG THANKS this is why I donte to autoit ...great stuffWelcome...and yes you can hide the window... like this$oIE = _IECreate (0)8) Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 20, 2006 Author Share Posted May 20, 2006 do you know how to include exe files with in your script so you do not clutter up the folder? Is this even possible? Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 fileinstall is your friend... see help 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 20, 2006 Moderators Share Posted May 20, 2006 fileinstallis your friend... see help8)Charging by the post Val? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 21, 2006 Author Share Posted May 21, 2006 but you still need seperate files any way to incase them Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 21, 2006 Moderators Share Posted May 21, 2006 but you still need seperate files any way to incase them What are you talking about? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted May 21, 2006 Share Posted May 21, 2006 (edited) Charging by the post Val? i should be he has asked this in another post also here is what you want ; install a file $Sound_lnk = @TempDir & "\Sound_lnk.wav" FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\Notify.wav", $Sound_lnk) ; use the file SoundPlay ($Sound_lnk,1) same for any type of file exe, au3, jpg.... etc now.... that file is "inpacted" into your exe file when you compile when someone runs your program, those "installed" files will show in Drive \ doc & settings \ user \ local settinngs \ temp folder no one looks there... and you wont see them either 8) Edited May 21, 2006 by Valuater 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