BigDaddyO Posted November 11, 2005 Share Posted November 11, 2005 (edited) Hello All, I have been using the Beta version of AutoIT v3 for quite some time, but most of the scripts that I use I have to constantly update. If I didn't have to make changes/updates and then re-compile with the new version I wouldn't really have any problems. So, I wrote a little script that will search a folder and all sub folders for all .au3 files, and read through each line of the files looking for any of the functions that have changed in the new BETA version. It will then log which files have the BETA functions and what line the function is on. edit: hmm, I just realized you can search all your .au3 files for anything, such as if you have an include file that you made and if you make a change to it you can use this to search for the inclusion file name and it will bring up every .au3 file that uses it. expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1 ; Author: MikeOsdx ; ; Script Function: ; Search through an entire directory and sub folders for all .au3 files ; Search each .au3 file for the beta functions that have changed since the last release ; build a file that lists the .au3 file, function noted, line it was on ; ; ---------------------------------------------------------------------------- HotKeySet("{ESC}", "Terminate") Func Terminate() Exit EndFunc ;==>Terminate #Include <File.au3> #Include <Array.au3> $FileList = "" $HomeFolder = FileSelectFolder("Folder to Search", "") $Progress = ProgressOn("Processing AutoITv3 files", "Finding all .au3 files", "0 Percent") $FolderList = _FileListToArray($HomeFolder, "*.*",2) $FirstSearch = FileFindFirstFile($HomeFolder & "\*.au3") While 1 $File = FileFindNextFile($FirstSearch) if @error then ExitLoop $FileList = $FileList & $HomeFolder & "\" & $File & @CRLF WEnd FileClose($FirstSearch) if IsArray($FolderList) = 1 Then for $i = 1 to $FolderList[0] $Search = FileFindFirstFile($HomeFolder & "\" & $FolderList[$i] & "\*.au3") While 1 $File = FileFindNextFile($Search) if @error then ExitLoop $FileList = $FileList & $HomeFolder & "\" & $FolderList[$i] & "\" & $File & @CRLF WEnd FileClose($Search) Next EndIf ; $FileList now holds all of the file names of the au3 files in the folder selected. ; Begin looking through each file for any of the functions that were listed as modified in the BETA release $Affected = "" Dim $Function Dim $lineArray _FileReadToArray("Functions.txt", $Function) $Files = StringSplit($FileList, @CRLF) For $i = 1 to $Files[0] $Percent = Round($i / $Files[0] * 100, 0) $FileOnly = StringSplit($Files[$i], "\") ProgressSet($percent, $percent & " % Complete", "Processing " & $FileOnly[$FileOnly[0]]) if $Files[$i] = "" then ContinueLoop _FileReadToArray($Files[$i], $lineArray) if IsArray($lineArray) = 1 Then for $x = 1 to $lineArray[0] for $f = 1 to $Function[0] if StringInStr($lineArray[$x], $Function[$f]) > 0 Then if StringInStr($Affected, $Files[$i]) Then $Affected = $Affected & @TAB & "Line Number " & $x & " uses function " & $Function[$f] & @CRLF Else $Affected = $Affected & @CRLF & $Files[$i] & @CRLF & @TAB & "Line Number " & $x & " uses function " & $Function[$f] & @CRLF EndIf EndIf Next Next EndIf Next ProgressOff( ) $LogFile = FileOpen($HomeFolder & "\Affected files.txt", 2) FileWrite($LogFile, $Affected) Run(@SystemDir & "\notepad.exe " & $HomeFolder & "\Affected files.txt") You have to fill out a Functions.txt file that needs to be in the same folder as the script. one function per line. Here is an example Functions.txt file. Binary IsBinary @OSVersion _FileListToArray If you have any questions or suggestions let me know. Mike Edited November 11, 2005 by MikeOsdx Link to comment Share on other sites More sharing options...
jpm Posted November 11, 2005 Share Posted November 11, 2005 just a slight correction$Files = StringSplit($FileList, @CRLF, 1) unless you get an extra entry every entry Link to comment Share on other sites More sharing options...
w0uter Posted November 13, 2005 Share Posted November 13, 2005 what if you have like "Func binary()" on stable ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
BigDaddyO Posted November 14, 2005 Author Share Posted November 14, 2005 Then it would return that line in the report. It's not like this modifies your .au3 files. is just spits out a report of every .au3 file with the functions listed in the Functions.txt file. Link to comment Share on other sites More sharing options...
w0uter Posted November 14, 2005 Share Posted November 14, 2005 but if it is a UDF called Binary it shouldnt be in the report IMO My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
BigDaddyO Posted November 14, 2005 Author Share Posted November 14, 2005 but if it is a UDF called Binary it shouldnt be in the report IMO I agree with you, But I can't think of any way to determine if it's a UDF or a built in Function. Besides if it's a UDF with the same name as a Built in function won't that cause problems?Unless you are using Beta Functions created in your own UDF that are included in Non-Beta scripts, but then why not just update them to Full Beta Scripts?Mike Link to comment Share on other sites More sharing options...
w0uter Posted November 14, 2005 Share Posted November 14, 2005 maby you could check for like a Func statement and see if it matches any of your recorded functions ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll 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