Jump to content

Two functions at once?


Recommended Posts

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?

Link to comment
Share on other sites

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 :whistle:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...