Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging Face LMArena Human Preference 140K

set browsers to {"Safari", "Google Chrome", "Firefox"} tell application "System Events"…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4.1-2025-04-14’s answer.
  1. User

    set browsers to {"Safari", "Google Chrome", "Firefox"}

    tell application "System Events" set frontApp to name of first application process whose frontmost is true end tell

    if frontApp is in browsers then tell application frontApp to close front window else tell application "System Events" to keystroke "w" using command down end if

    • popraw mi akcję dla BTT, aby w przypadku gdy "w" nie zadziała, to niech wywoła "q"
  2. Mistral Assistant

    Oto poprawiona akcja dla BetterTouchTool (BTT), która najpierw spróbuje zamknąć okno za pomocą ⌘W, a jeśli to nie zadziała, spróbuje z ⌘Q:

    set browsers to {"Safari", "Google Chrome", "Firefox"}
    
    tell application "System Events"
        set frontApp to name of first application process whose frontmost is true
    end tell
    
    if frontApp is in browsers then
        tell application frontApp to close front window
    else
        try
            tell application "System Events" to keystroke "w" using command down
        on error
            tell application "System Events" to keystroke "q" using command down
        end try
    end if
    

    Wyjaśnienie zmian:

    1. Dodanie bloku try: Teraz skrypt najpierw próbuje wykonać ⌘W, a jeśli to się nie powiedzie (np. okno nie może być zamknięte), przechodzi do ⌘Q.
    2. Obsługa błędów: Jeśli keystroke "w" nie zadziała, skrypt automatycznie wywoła keystroke "q".

    Uwaga:

    • ⌘Q zamknie całą aplikację, a nie tylko okno, więc używaj tego ostrożnie.
    • Jeśli chcesz, aby skrypt najpierw próbował zamknąć okno, a potem dopiero aplikację, ta wersja jest odpowiednia.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.