Mateus_Terra Posted April 3, 2017 Share Posted April 3, 2017 I am making a script that needs to count the number of times a file in .exe and .vbs extension are deleted. I would like them to be displayed as a windows notification balloon. The script monitors a particular folder and deletes any .exe or .vbs that is created. Hence I need to count how many files have been deleted! Somebody help me? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2017 Moderators Share Posted April 3, 2017 Mateus_Terra, Welcome to the AutoIt forums. I suggest you need to monitor the folder in question using one of the available UDFs (search FileSystemMonitor and RDC) and then when one of the defined files is created in the folder you can delete it and add to the count. Sounds like a fun project , but out of interest why do you need to do it? 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 Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 3 minutes ago, Melba23 said: Mateus_Terra, Welcome to the AutoIt forums. I suggest you need to monitor the folder in question using one of the available UDFs (search FileSystemMonitor and RDC) and then when one of the defined files is created in the folder you can delete it and add to the count. Sounds like a fun project , but out of interest why do you need to do it? M23 This is a virus that is entering our company system, the virus enters the machine in .exe and .vbs format. I have already been able to delete them immediately and I am able to survive this way .. I wanted to implement the count of how many "viruses" it would be deleting. Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 Look at my script. It's incredible that it seems to be solving my problem effectively. while 1 $arquivovbs = "*.vbs" $arquivoexe = "*.exe" $iDeletevbs0 = FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\"&$arquivovbs) $ideleteexe0 = FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\"&$arquivoexe) $iDeletevbs1 = FileDelete("C:\Totvs\jboss-4.2.3.GA\client\"&$arquivovbs) $ideleteexe1 = FileDelete("C:\Totvs\jboss-4.2.3.GA\client\"&$arquivoexe) $iDeletevbs2 = FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\"&$arquivovbs) $ideleteexe2 = FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\"&$arquivoexe) $iDeletevbs3 = FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\"&$arquivovbs) $ideleteexe3 = FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\"&$arquivoexe) $iDeletevbs4 = FileDelete("C:\Totvs\jboss-4.2.3.GA\server\"&$arquivovbs) $ideleteexe4 = FileDelete("C:\Totvs\jboss-4.2.3.GA\server\"&$arquivoexe) WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2017 Moderators Share Posted April 3, 2017 (edited) Mateus_Terra, I take it that you are doing something to prevent the infection rather then just deleting these files? M23 Edit: And if you really want a count, just check the return value from the FileDelete call and add it to a counter: $arquivovbs = "*.vbs" $arquivoexe = "*.exe" $iDeletevbs0 = 0 $ideleteexe0 = 0 $iDeletevbs1 = 0 $ideleteexe1 = 0 $iDeletevbs2 = 0 $ideleteexe2 = 0 $iDeletevbs3 = 0 $ideleteexe3 = 0 $iDeletevbs4 = 0 $ideleteexe4 = 0 While 1 ; Add to the count each time a deletion occurs $iDeletevbs0 += FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\" & $arquivovbs) $ideleteexe0 += FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\" & $arquivoexe) $iDeletevbs1 += FileDelete("C:\Totvs\jboss-4.2.3.GA\client\" & $arquivovbs) $ideleteexe1 == FileDelete("C:\Totvs\jboss-4.2.3.GA\client\" & $arquivoexe) $iDeletevbs2 += FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\" & $arquivovbs) $ideleteexe2 += FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\" & $arquivoexe) $iDeletevbs3 += FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\" & $arquivovbs) $ideleteexe3 += FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\" & $arquivoexe) $iDeletevbs4 += FileDelete("C:\Totvs\jboss-4.2.3.GA\server\" & $arquivovbs) $ideleteexe4 += FileDelete("C:\Totvs\jboss-4.2.3.GA\server\" & $arquivoexe) Sleep(10) ; Not a bad idea to prevent the CPU frying WEnd Edited April 3, 2017 by Melba23 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 Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted April 3, 2017 Share Posted April 3, 2017 Just to add to Melba's solution. Maybe an AdlibRegister() function to write current counts to a log file. Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 2 hours ago, Melba23 said: Mateus_Terra, I take it that you are doing something to prevent the infection rather then just deleting these files? M23 Edit: And if you really want a count, just check the return value from the FileDelete call and add it to a counter: $arquivovbs = "*.vbs" $arquivoexe = "*.exe" $iDeletevbs0 = 0 $ideleteexe0 = 0 $iDeletevbs1 = 0 $ideleteexe1 = 0 $iDeletevbs2 = 0 $ideleteexe2 = 0 $iDeletevbs3 = 0 $ideleteexe3 = 0 $iDeletevbs4 = 0 $ideleteexe4 = 0 While 1 ; Add to the count each time a deletion occurs $iDeletevbs0 += FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\" & $arquivovbs) $ideleteexe0 += FileDelete("C:\Totvs\jboss-4.2.3.GA\bin\" & $arquivoexe) $iDeletevbs1 += FileDelete("C:\Totvs\jboss-4.2.3.GA\client\" & $arquivovbs) $ideleteexe1 == FileDelete("C:\Totvs\jboss-4.2.3.GA\client\" & $arquivoexe) $iDeletevbs2 += FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\" & $arquivovbs) $ideleteexe2 += FileDelete("C:\Totvs\jboss-4.2.3.GA\docs\" & $arquivoexe) $iDeletevbs3 += FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\" & $arquivovbs) $ideleteexe3 += FileDelete("C:\Totvs\jboss-4.2.3.GA\lib\" & $arquivoexe) $iDeletevbs4 += FileDelete("C:\Totvs\jboss-4.2.3.GA\server\" & $arquivovbs) $ideleteexe4 += FileDelete("C:\Totvs\jboss-4.2.3.GA\server\" & $arquivoexe) Sleep(10) ; Not a bad idea to prevent the CPU frying WEnd rsrsrs I'm burning my head. I've never used this function. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2017 Moderators Share Posted April 3, 2017 Mateus_Terra, Google tells me what "rsrsrs" is in Portuguese ("LOL") but to which function are you referring? If you mean "+=" then please see this page in the Help file. 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 Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 2 minutes ago, Melba23 said: Mateus_Terra, Google tells me what "rsrsrs" is in Portuguese ("LOL") but to which function are you referring? If you mean "+=" then please see this page in the Help file. M23 Yes, I'm in Brazil ... :-) I'll do some research! kkkkkkkkkk Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2017 Moderators Share Posted April 3, 2017 Mateus_Terra, Delighted to hear it. But when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. 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 Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 FileFindFirstFile and TrayTip Is it what I should use? Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 3, 2017 Author Share Posted April 3, 2017 2 minutes ago, Melba23 said: Mateus_Terra, Delighted to hear it. But when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. M23 Soooooorry man.... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2017 Moderators Share Posted April 3, 2017 Mateus_Terra, Where have I mentioned FileFindFirstFile? And I would recommend TraySetToolTip rather then TrayTip - that way you only get the tip displaying if you hover over the tray icon rather than a permanent display. And you still have not answered my question: 3 hours ago, Melba23 said: I take it that you are doing something to prevent the infection rather then just deleting these files? 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 Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 6, 2017 Author Share Posted April 6, 2017 On 03/04/2017 at 5:08 PM, Melba23 said: Mateus_Terra, Where have I mentioned FileFindFirstFile? And I would recommend TraySetToolTip rather then TrayTip - that way you only get the tip displaying if you hover over the tray icon rather than a permanent display. And you still have not answered my question: M23 I do not understand your question .. We're trying to figure out a way to prevent infection by yes, but even we can not and depend on the program's function in the meantime! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2017 Moderators Share Posted April 6, 2017 Mateus_Terra, Stop using the "Quote" button to reply - you apologised for doing so in post #12 and here you are doing it again! My question relates to your comment in post #11 On 03/04/2017 at 8:42 PM, Mateus_Terra said: FileFindFirstFile and TrayTip Is it what I should use? So I ask again - why do you bring FileFindFirstFile into it? All you need to do to the script developed above is to add a TraySetToolTip so that you can see the current deletion count when you hover over the icon. But the content of such a tooltip is limited, so you might want to think of using something else - and my Toast & Notify UDFs (look in my sig for the links) are designed for exactly this type of thing. Display one of those each time a file is deleted and I think you have a good working solution. Let me know if you would like some help getting it all to work. And I am delighted to hear you are working on removing the virus - a much better long-term solution. 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 Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 7, 2017 Author Share Posted April 7, 2017 Melba23, thanks for all your patience and attention. I'm new here and I still do not know how exactly the forum works, and has the translation question as well.So far all the scripts I've done have been without forum help, I've made scripts much more complex than this one, including a point of entry and exit register, which works very well. But this simple option to tell I'm stuck. Kkkkkk your help would be very welcome if possible for! Link to comment Share on other sites More sharing options...
Mateus_Terra Posted April 7, 2017 Author Share Posted April 7, 2017 Seria algo assim? TraySetToolTip("Número de Vírus.exe deletados: "&$ideleteexe0+$ideleteexe1+$ideleteexe2+$ideleteexe3+$ideleteexe4&Chr(13)&"Número de Vírus.vbs deletados: "&$iDeletevbs0+$iDeletevbs1+$iDeletevbs2+$iDeletevbs3+$iDeletevbs4) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2017 Developers Share Posted April 7, 2017 4 minutes ago, Mateus_Terra said: Seria algo assim? Geen idee what je bedoeld want ik spreek geen portugees. Try English as that is in general much clearer for most of us. Jos 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...
Mateus_Terra Posted April 7, 2017 Author Share Posted April 7, 2017 Kkkkkk I'm getting crazy Was it something like that? TraySetToolTip ("Number of Viruses.exe Deleted:" & $ iDeletevbs0 + $ iDeletevbs1 + $ iDeletevbs2 + $ iDeletevbs3 + $ iDeletevbs4) $ & $ ideleteexe0 + $ ideleteexe2 + $ ideleteexe2 + $ ideleteexe3 + $ ideleteexe4 & Chr (13) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2017 Developers Share Posted April 7, 2017 Still unsure what the question is you have here. You show a line of code containing syntax errors as there are spaces between the $ and the variable name. So what about you use a couple more English words to describe the issue/question and show the total code snipped if possible. Jos 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...
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