RexRomae Posted February 19, 2008 Share Posted February 19, 2008 (edited) Hello everybody, I have a problem with this script, I want know how many elements there are in an array? enjoy my script! CODE#include <Array.au3> #include <IE.au3> ; Autore: Rex Romae $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_tmp = FileFindNextFile($search_tmp) $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop MsgBox(0,"FileControll: Avviso!","Sono stati trovati: NUMBER OF FILES FIND, saranno subito eliminati!") ;FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") ;FileDelete("C:\Documents and Settings\Administrator\*.exe") WEnd FileClose($search_tmp) FileClose($search_exe) Edited February 19, 2008 by RexRomae Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 19, 2008 Share Posted February 19, 2008 Hi, Ubound? Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
RexRomae Posted February 19, 2008 Author Share Posted February 19, 2008 (edited) so? $u = Ubound($search_tmp) When I print $u in a MsgBox its repeat for the numbers of elements and it prints 0! Are you understanding? U can try! Edited February 19, 2008 by RexRomae Link to comment Share on other sites More sharing options...
weaponx Posted February 19, 2008 Share Posted February 19, 2008 You don't even have an array in your script. Use _FileListToArray, its in the help file. Link to comment Share on other sites More sharing options...
RexRomae Posted February 19, 2008 Author Share Posted February 19, 2008 _FileListToArray give me back an array right?? Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 _FileListToArray give me back an array right??That's right Using Your origional code (no array used) Then you could also add a variable #include <Array.au3> #include <IE.au3> ; Autore: Rex Romae $f_Count = 0 $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_tmp = FileFindNextFile($search_tmp) $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop $f_Count += 1 MsgBox(0,"FileControll: Avviso!","Sono stati trovati: NUMBER OF FILES FIND, saranno subito eliminati!") ;FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") ;FileDelete("C:\Documents and Settings\Administrator\*.exe") WEnd FileClose($search_tmp) FileClose($search_exe) MsgBox(0, "Found", $f_Count & " files have been found") 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...
RexRomae Posted February 19, 2008 Author Share Posted February 19, 2008 Thank you, now I have this...It find only 1 file, why?? CODE#include <Array.au3> #include <IE.au3> $f_Count_tmp = 0 $f_Count_exe = 0 $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_tmp = FileFindNextFile($search_tmp) $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop $f_Count_tmp += 1 $f_Count_exe += 1 FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") FileDelete("C:\Documents and Settings\Administrator\*.exe") WEnd FileClose($search_tmp) FileClose($search_exe) MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_tmp &" files jar_cache infetti, sono stati eliminati!") MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_exe &" files exe pericolosi, sono stati eliminati!") Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 (edited) Thank you, now I have this...It find only 1 file, why?? CODE#include <Array.au3> #include <IE.au3> $f_Count_tmp = 0 $f_Count_exe = 0 $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_tmp = FileFindNextFile($search_tmp) $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop $f_Count_tmp += 1 $f_Count_exe += 1 FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") FileDelete("C:\Documents and Settings\Administrator\*.exe") WEnd FileClose($search_tmp) FileClose($search_exe) MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_tmp &" files jar_cache infetti, sono stati eliminati!") MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_exe &" files exe pericolosi, sono stati eliminati!")For openers that whole While loop is messed up. You are only checking @Error for $file_exe. There are two better methods to use. The first would be to create 2 arrays using _FileListToArray() and then 2 loops to handle the files. The other is to just create 2 Loops. One for each FileFindNextFile(). The following should be close. #include <Array.au3> #include <IE.au3> $f_Count_tmp = 0 $f_Count_exe = 0 $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") While 1 $file_tmp = FileFindNextFile($search_tmp) If @error Then ExitLoop $f_Count_tmp += 1 FileDelete($File_tmp) WEnd FileClose($search_tmp) $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop $f_Count_exe += 1 FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") FileDelete($File_Exe) WEnd FileClose($search_exe) MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_tmp &" files jar_cache infetti, sono stati eliminati!") MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_exe &" files exe pericolosi, sono stati eliminati!") Edited February 19, 2008 by GEOSoft 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...
RexRomae Posted February 19, 2008 Author Share Posted February 19, 2008 also thanks, I have put it in auto-execution and when I start windows it works, but during the time it doesn't work! I want that It always working, how do I make it? thanks Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 also thanks, I have put it in auto-execution and when I start windows it works, but during the time it doesn't work! I want that It always working, how do I make it? thanksIf you mean that you never want the file to exit then do this. (not recommended) #include <Array.au3> #include <IE.au3> While 1 $f_Count_tmp = 0 $f_Count_exe = 0 $search_tmp = FileFindFirstFile("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") While 1 $file_tmp = FileFindNextFile($search_tmp) If @error Then ExitLoop $f_Count_tmp += 1 FileDelete($File_tmp) WEnd FileClose($search_tmp) $search_exe = FileFindFirstFile("C:\Documents and Settings\Administrator\*.exe") While 1 $file_exe = FileFindNextFile($search_exe) If @error Then ExitLoop $f_Count_exe += 1 FileDelete("C:\Documents and Settings\Administrator\Impostazioni locali\Temp\jar_cache*.*") FileDelete($File_Exe) WEnd FileClose($search_exe) MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_tmp &" files jar_cache infetti, sono stati eliminati!") MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_exe &" files exe pericolosi, sono stati eliminati!") Wend 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...
RexRomae Posted February 19, 2008 Author Share Posted February 19, 2008 (edited) Why not recommended? opsss with your script the loop don't have finish I have edit it, but I would want that the script is always ON and that it show the MsgBox only if the exe or jar_cache are presents! I don't succeed Edited February 19, 2008 by RexRomae Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 Why not recommended? opsss with your script the loop don't have finish I have edit it, but I would want that the script is always ON and that it show the MsgBox only if the exe or jar_cache are presents! I don't succeed If $f_Count_tmp > 0 Then MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_tmp &" files jar_cache infetti, sono stati eliminati!") If $f_Count_exe > 0 Then MsgBox(0,"FileControll: Avviso!","Sono stati trovati: "& $f_Count_exe &" files exe pericolosi, sono stati eliminati!") 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