Captnplanet Posted July 2, 2007 Posted July 2, 2007 Hello, I've got a question about a script with 2 loops in it. Is it possible to run them both at the same time? Right now I got Search ("C:\", "1337");replace with your search directory and file extension required Func Search($current,$ext) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then If StringRight($current & "\" & $file,StringLen($ext)) = $ext then ;MsgBox (0, "Has the file extension " & $ext, $current & "\" & $file) ;this is where you do what you need to do FileDelete ($current & "\" & $file) Endif EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then Search($current & "\" & $file, $ext) EndIf Sleep(1) WEnd FileClose($search) EndFunc while -1 If ProcessExists("explorer.exe") then msgbox(1, "test1", "explorer works") If ProcessExists("taskmgr.exe") then msgbox(1, "test2", "taskmgr works") sleep(5) WEnd This first deletes all files with the .1337 extension on your harddrive. Then if explorer.exe or taskmgr.exe is running it returns a msgbox. If you click ok or cancel it restarts the msgbox. I want the restarting msgbox function while the harddrive is searched for 1337 files and deleted. Is this possible?
Toady Posted July 2, 2007 Posted July 2, 2007 Yes, just make the while loop containing the ProcessExists get ran every couple of milliseconds. Look at AdlibEnable() in the help file. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
Captnplanet Posted July 2, 2007 Author Posted July 2, 2007 Argh, actually I cant get that to work. I keep getting either getting endfunc or wend missing statements or not getting any msgboxes. Help?
Captnplanet Posted July 3, 2007 Author Posted July 3, 2007 AdlibEnable("myadlib") Func myadlib If ProcessExists("explorer.exe") Then msgbox(1, "lol", "text") EndIf EndFunc That's what I got so far trying to get the popup. This is exactly what the help file said about the usage of AdlibEnable, but it doesnt seem to be working for me. No popup and I'm pretty sure Explorer is running
Generator Posted July 3, 2007 Posted July 3, 2007 This worked for me? AdibeEnable is a check, you still have to have the main script running to keep the check going. Also you were missing parameter for the func. AdlibEnable("myadlib") While 1 Sleep(1) WEnd Func myadlib() If ProcessExists("explorer.exe") Then msgbox(1, "lol", "text") EndIf EndFunc
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