Eric Chang Posted June 14, 2007 Share Posted June 14, 2007 Dear All I try to use AUTOIT to fetch the last modified time of some files But with this code , I got nothing output with var $t , $t1 the c:\erp\pbd.txt does exists and contain correct datas . and I do not know what`s wrong ? Please help , thanks . #include <file.au3> If FileExists("c:\erp\pbd.txt") Then FileDelete("c:\erp\pbd.txt") EndIf RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE) $count_lines = _FileCountLines("c:\erp\pbd.txt") $file = FileOpen("c:\erp\pbd.txt", 0) $i = 1 While $i <= $count_lines $line = FileReadLine($file) $t = FileGetTime("c:\erp\" & $line, 0) $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0) $i=$i+1 WEnd FileClose($file) Link to comment Share on other sites More sharing options...
November Posted June 14, 2007 Share Posted June 14, 2007 (edited) Dear All I try to use AUTOIT to fetch the last modified time of some files But with this code , I got nothing output with var $t , $t1 the c:\erp\pbd.txt does exists and contain correct datas . and I do not know what`s wrong ? Please help , thanks . #include <file.au3> If FileExists("c:\erp\pbd.txt") Then FileDelete("c:\erp\pbd.txt") EndIf RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE) $count_lines = _FileCountLines("c:\erp\pbd.txt") $file = FileOpen("c:\erp\pbd.txt", 0) $i = 1 While $i <= $count_lines $line = FileReadLine($file) $t = FileGetTime("c:\erp\" & $line, 0) $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0) $i=$i+1 WEnd FileClose($file) Hi there, 1st - where is $line? 2nd - try this to use Ubound Cheers Edited June 14, 2007 by november Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
Developers Jos Posted June 14, 2007 Developers Share Posted June 14, 2007 Dear All I try to use AUTOIT to fetch the last modified time of some files But with this code , I got nothing output with var $t , $t1 the c:\erp\pbd.txt does exists and contain correct datas . and I do not know what`s wrong ? Please help , thanks . #include <file.au3> If FileExists("c:\erp\pbd.txt") Then FileDelete("c:\erp\pbd.txt") EndIf RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE) $count_lines = _FileCountLines("c:\erp\pbd.txt") $file = FileOpen("c:\erp\pbd.txt", 0) $i = 1 While $i <= $count_lines $line = FileReadLine($file) $t = FileGetTime("c:\erp\" & $line, 0) $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0) $i=$i+1 WEnd FileClose($file)I do not see anywhere in your script how you handle the received information in variable $t and $t1 ... Hi there, 1st - where is $line? 2nd - try this to use Ubound Cheers1st = The line below while ? 2nd = Ubound on what ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Eric Chang Posted June 15, 2007 Author Share Posted June 15, 2007 I do not see anywhere in your script how you handle the received information in variable $t and $t1 ... yap , sorry , I deleted one more line .... the code should be like this ..... #include <file.au3> If FileExists("c:\erp\pbd.txt") Then FileDelete("c:\erp\pbd.txt") EndIf RunWait(@ComSpec & " /c" & "dir /b c:\erp\*.pbd >> c:\erp\pbd.txt",'', @SW_HIDE) $count_lines = _FileCountLines("c:\erp\pbd.txt") $file = FileOpen("c:\erp\pbd.txt", 0) $i = 1 While $i <= $count_lines $line = FileReadLine($file) $t = FileGetTime("c:\erp\" & $line, 0) $t1 = FileGetTime("\\erp-server\erp\pbd\" & $line ,0) msgbox(4096,"title",$t) $i=$i+1 WEnd FileClose($file) Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2007 Share Posted June 15, 2007 FileGetTime() returns an array be default, unless you add the "format flag": ; $t = FileGetTime("c:\erp\" & $line, 0) $t = FileGetTime("c:\erp\" & $line, 0, 1) Now, as penance for not reading the help file, say 20 "Hail Katrijn's", and do 20 hours of pro bono coding for the poor... 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 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