GEOSoft Posted December 28, 2003 Share Posted December 28, 2003 Does anyone know a good loop to get the names of all the DLL and OCX files in the %System% folder and write the filename, modified date and version number of each to a file? It is needed to check if any files have been changed since the app was last run ( similiar to the Windows SFC of the past). The next stage will be comparing the lists but that can wait for a while.I also need a method to Append the contents of a text file to the clipboard. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
CyberSlug Posted December 29, 2003 Share Posted December 29, 2003 Since no one else has posted, here you go expandcollapse popup; Append text to clipboard $textFromFile = "code to get text from file goes here..." $clipBAK = ClipGet() ClipPut($clipBAK & @CRLF & $textFromFile) ;Get the names of all the DLL and OCX files in the %System% folder, and ;write the filename, modified date and version number of each to a file ;Generates a tab-separated file with Name, Version, and TimeStamp. $outputFile = "DllOcxInfo.txt" $output = FileOpen($outputFile, 1) ;write/append file mode If $output = -1 Then;see if file opened for writing OK MsgBox(0, "Error", "Unable to open file.") Exit EndIf SplashTextOn("Please wait", "Writing DLL and OCX info to " & $outputFile) ; DLL Files $fileName = FileFindFirstFile(@SystemDir & "\*.dll") $errorFlag = @error $modTime = prettyPrintTime(@SystemDir & "\" &$fileName) $version = FileGetVersion(@SystemDir & "\" &$fileName) While $errorFlag = 0 ;note that Chr(9) is the tab character FileWriteLine($output, _ $fileName & Chr(9) & $version & Chr(9) & $modTime & @LF) $fileName = FileFindNextFile() $errorFlag = @error $modTime = prettyPrintTime(@SystemDir & "\" &$fileName) $version = FileGetVersion(@SystemDir & "\" &$fileName) WEnd ; OCX Files $fileName = FileFindFirstFile(@SystemDir & "\*.ocx") $errorFlag = @error $modTime = prettyPrintTime(@SystemDir & "\" &$fileName) $version = FileGetVersion(@SystemDir & "\" &$fileName) While $errorFlag = 0 ;note that Chr(9) is the tab character FileWriteLine($output, _ $fileName & Chr(9) & $version & Chr(9) & $modTime & @LF) $fileName = FileFindNextFile() $errorFlag = @error $modTime = prettyPrintTime(@SystemDir & "\" &$fileName) $version = FileGetVersion(@SystemDir & "\" &$fileName) WEnd FileClose($output) SplashOff() MsgBox(0,"","Operation Completed") Exit Func prettyPrintTime($fileName) $t = FileGetTime($fileName, 0) ;0=modificationTime If @error Then Return "TimeStampError" $hr = $t[3] $min = $t[4] $sec = $t[5] If $min < 10 Then $min = "0" & $min If $sec < 10 Then $sec = "0" & $sec $time = ($hr & ":" & $min & ":" & $sec) ; h:mm:ss (24-hour format) $date = $t[1] & "/" & $t[2] & "/" & $t[0] ; m/d/yyyy format Return ($time & " " & $date) EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
GEOSoft Posted December 29, 2003 Author Share Posted December 29, 2003 Thanks CS. That's a starting point at least. I'll see what I can do with it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
CyberSlug Posted December 29, 2003 Share Posted December 29, 2003 I just realized that my append-clipboard-text response has a bug: If the clipboard is empty or contains a picture, $bak is the number zero! Here's a better solution: ; Note: Perhaps you don't want to use @CRLF at all Func ClipAppend($text) $bak = ClipGet() If @error Then ClipPut($text) Else ClipPut($bak & @CRLF & $text) EndIf EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
GEOSoft Posted December 29, 2003 Author Share Posted December 29, 2003 Thanks again. I had not gotten around to trying it yet anyway. I still have a lot of other code to do for this project. I should have thought right away to place it in a tempfile first and then append. I must have been brain dead at that moment. I actually have to append the contents of Autoexec.bat, Config.sys,Dosstart.bat and portions of the System.ini files if they exist. It may all be redundent anyway because of the hassles with onclick functions for the buttons in Larry's GUI. I'm begining th think that Delphi is going to be more suitable than a compiled macro. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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