Guest User

thunderbird-autostart.ahk

a guest
Sep 14th, 2025
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey v2.0
  2.  
  3. ; Blokada uruchomienia jako admin
  4. if A_IsAdmin
  5. {
  6.     MsgBox("Nie uruchamiaj tego skryptu jako administrator!", "Ostrzeżenie", 48)
  7.     ExitApp
  8. }
  9.  
  10. exePath := "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
  11. processName := "thunderbird.exe"
  12.  
  13. if !FileExist(exePath)
  14. {
  15.     MsgBox("Nie znaleziono pliku Thunderbird.exe pod ścieżką:`n" exePath, "Błąd", 16)
  16.     ExitApp
  17. }
  18.  
  19. pid := ProcessExist(processName)
  20.  
  21. if pid
  22. {
  23.     ; Sprawdzenie czy istnieje i jest widoczne okno Thunderbirda
  24.     hwnd := WinExist("ahk_exe " processName)
  25.     if hwnd && WinActive("ahk_id " hwnd)
  26.     {
  27.         ; Minimalizuj tylko jeśli okno jest widoczne
  28.         WinMinimize("ahk_id " hwnd)
  29.     }
  30.     ; jeśli okno nie istnieje lub jest schowane do traya, nic nie robimy
  31. }
  32. else
  33. {
  34.     Run(exePath)
  35.     Sleep 3000
  36.  
  37.     hwnd := WinExist("ahk_exe " processName)
  38.     if hwnd
  39.         WinMinimize("ahk_id " hwnd)
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment