am632 Posted November 18, 2014 Posted November 18, 2014 Hi, Im trying to make a simple adware/junk remover. I plan to store a list of files, folders, registry keys etc in a simple database which I have made using Sqlitebrowser. I have put together this script so far,which loads the db and displays a list of the results in 3 arays (1 for each table) #include <Array.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> #include <File.au3> Local $aResultFolders, $aResultFiles, $iRows, $iColumns, $Database, $DBTABLEFOLDERS, $DBTABLEFILES, $DBTABLEREGISTRY, $aResultRegistry SplashTextOn("","Loading Database",100,60,-1,-1) _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $Database = _SQLite_Open(@ScriptDir & "\database.db") If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf SplashOff() $DBTABLEFOLDERS = _SQLite_GetTable($Database,"SELECT * FROM folders;", $aResultFolders,$iRows,$iColumns) $DBTABLEFILES = _SQLite_GetTable($Database,"SELECT * FROM files;", $aResultFiles, $iRows, $iColumns) $DBTABLEREGISTRY = _SQLite_GetTable($Database,"SELECT * FROM registry;", $aResultRegistry, $iRows, $iColumns) _ArrayDisplay($aResultFolders, "Query Result") _ArrayDisplay($aResultFiles, "Query Result") _ArrayDisplay($aResultRegistry, "Query Result") Func _SearchFiles() EndFunc _SQLite_Close() _SQLite_Shutdown() Im struggling with the next part which is a function to search the computer for the content in the database to see if it exists. (I will list the found items in a listview later but just displaying them in an array will do for now) Would I use the FindFileFirstFile & FindFileNextFile functions for this? I have looked in the help file and im not sure how i'd use the info from my array returned from the database with this. Also would these functions search for folders aswell? I have looked in the helpfile for searching the registry aswell but I dont know which function i'd use for this is there 1 builtin or would I need a 3rd party function? If I wanted to do a general search of the registry for a keyword for example, the sample 'junk' i used in my database is some software called 'pcfixspeed' so I'd want to search the registry for all references to this. I have attached my database file which i'm using with this script. Thanks database.zip
Moderators Melba23 Posted November 18, 2014 Moderators Posted November 18, 2014 am632,To search for files and folders on your drives, I suggest _FileListToArrayRec - this will search all folders recursively, but be warned that it can take a while on large drives. However, you can search for several patterns at a time to help keep the execution time to a minimum. As to the registry, I have never seen a search tool in AutoIt - but that does not mean one does not exist. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jguinch Posted November 18, 2014 Posted November 18, 2014 what about FileExists (works for both files and folders) and RegRead ? Also _IsRegistryExist, or this one : Func _RegExists($sKeyname, $sValueName = "") Local $iRet RegRead($sKeyName, $sValueName) Return ( $svalueName = "" ? @error <= 0 : @error = 0 ) EndFunc Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Moderators Melba23 Posted November 19, 2014 Moderators Posted November 19, 2014 jguinch,FileExists requires a full path - not a lot of use if you only know the name. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
iamtheky Posted November 19, 2014 Posted November 19, 2014 Feel free to play along here as well: '?do=embed' frameborder='0' data-embedContent>> Seems the intent is similar. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
jguinch Posted November 19, 2014 Posted November 19, 2014 @Melba : as usual, I read too fast... So, for registry entries my suggest is not good to... You can maybe look at >_RegEnumKeyEx for this iamtheky 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
kylomas Posted November 19, 2014 Posted November 19, 2014 am632, You may be interested in kafu's >SMF. This utility is fast and comprehensive. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
am632 Posted November 24, 2014 Author Posted November 24, 2014 Hi, thanks for all the replies, sorry for the late reply I havn't been well recently. I think the _FileListToArrayRec looks like a good solution for the files search - Could you possibly provide me with an example of how I'd use the information from my $aResultFiles array? I guess the $sMask part of the function would need to be populated with my values from the array right? but I dont know how i'd do this, I cant seem to find an example in the help file. Or is this not the correct way to use this function? Thanks
am632 Posted January 12, 2015 Author Posted January 12, 2015 Hi, Sorry to dig up the old post again but i'm just getting around to continuing my project. I have a few questions to get the search working, i'm going to forget about the sqdb for the time being while I get the search working correctly, I have the following script to search for all au3's on the c drive and display the results in an array... #Include <Array.au3> #include <File.au3> SplashTextOn("","Scanning for files...","250","100","-1","-1",33,"","","") $Array = _FileListToArrayRec("C:\","*.au3",1,1,0,1) SplashOff() _ArrayDisplay($Array,"Array") This code works fine, but how can I search for other filetypes such as .bat files at the same time and display in the array? I tried using _FileListToArrayRec("C:","*.au3,*.bat",1,1,0,1) with no success This was just a guess attempt as the help file under the _FileListToArrayRec didn't mension about multiple different includes. My thinking is if I can search for all my file types at once and have them all display in the array it will be quicker than searching for all of 1 file type and displaying the results then searching again for another and so on. Thanks
iamtheky Posted January 13, 2015 Posted January 13, 2015 use a semicolon #include <File.au3> #include <Array.au3> $aArray = _FileListToArrayRec(@ScriptDir , "*.exe ; *.au3") _ArrayDisplay($aArray) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Moderators Melba23 Posted January 13, 2015 Moderators Posted January 13, 2015 am632, the help file under the _FileListToArrayRec didn't mension about multiple different includesOh yes it does! $sMask - [optional] Filter for result. Multiple filters must be separated by ";"So do as boththose has suggested and it will work. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
am632 Posted January 14, 2015 Author Posted January 14, 2015 Ah yes, I see it now I must have skipped over it. This is working as I expect now except it doesnt appear to work for folders, heres what I have so far... #Include <Array.au3> #include <File.au3> SplashTextOn("","Scanning for files...","250","100","-1","-1",33,"","","") $Array = _FileListToArrayRec("C:\","*au3*",1,1,0,1) SplashOff() _ArrayDisplay($Array,"Array") So the code I have will display all files on my computer with au3 in the name or extension but wont list folders with au3 in the name. I have tried changing the $iReturn parameter to 0 which in the help file says it returns files and folders but all this seems to do for me is list every folder on my pc ignoring the name. Am I using this wrong? Thanks
Moderators Melba23 Posted January 14, 2015 Moderators Posted January 14, 2015 am632, it doesnt appear to work for foldersYour code:_FileListToArrayRec("C:\", "*au3*", 1, 1, 0, 1) ; $sFilePath $sMask $iReturn $iRecur $iSort $iReturnPathNow we look at the Help file explanation for $iReturn:$iReturn [optional] Specifies whether to return files, folders or both and omit those with certain attributes $FLTAR_FILESFOLDERS (0) - (Default) Return both files and folders $FLTAR_FILES (1) - Return files only $FLTAR_FOLDERS (2) - Return Folders onlylooking at the value you have set (1) what do you think it will return? I must have skipped over it.This seems to be becoming a habit..... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
am632 Posted January 14, 2015 Author Posted January 14, 2015 I did set iReturn to 0 before posting but it just seems to list every folder on my pc regardless of the name, do you know why this is?
Valuater Posted January 14, 2015 Posted January 14, 2015 I personally did a lot of work on this... '?do=embed' frameborder='0' data-embedContent>> 8)
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