0 votes

Erreur de raccourcis Siri - J'essaie d'exécuter un Applescript qui utilise les "événements système".

J'essaie d'exécuter un Applescript qui centre la fenêtre avec le focus. Le raccourci fonctionne bien, mais lorsque j'essaie d'utiliser la commande vocale avec Siri, une erreur "System Event" se produit, apparemment Siri n'a pas l'autorisation d'accès.

Quelqu'un a déjà vu ce problème.

Screenshot showing the error.

Traduction de l'erreur du portugais à l'anglais : Je suis désolé, il y a eu un problème. Les raccourcis disent : "System Events got a Error" : Shortcuts is an assistive access no Allowed".

0voto

On run {input, parameters} tell application "Finder set screenSize aux limites de la fenêtre du bureau set screenWidth à l'élément 3 de screenSize set screenHeight à l'élément 4 de screenSize fin du message

tell application "System Events"
    tell dock preferences
        if screen edge is bottom then
            tell application "System Events" to tell process "Dock"
                set dockSize to size in list 1
                set dockHeight to item 2 of dockSize
                set screenHeight to (screenHeight - dockHeight)
            end tell
        else if screen edge is left then
            tell application "System Events" to tell process "Dock"
                set dockSize to size in list 1
                set dockHeight to item 1 of dockSize
                set screenWidth to (screenWidth + dockHeight)
            end tell
        else
            tell application "System Events" to tell process "Dock"
                set dockSize to size in list 1
                set dockHeight to item 1 of dockSize
                set screenWidth to (screenWidth - dockHeight)
            end tell
        end if
    end tell

    set screenHeight to (screenHeight + 22)
    set myFrontMost to name of first item of ¬
        (processes whose frontmost is true)
end tell

try
    tell application myFrontMost
        set windowSize to bounds of window 1
        set windowXl to item 1 of windowSize
        set windowYt to item 2 of windowSize
        set windowXr to item 3 of windowSize
        set windowYb to item 4 of windowSize

        set windowWidth to windowXr - windowXl
        set windowHeight to windowYb - windowYt

        if myFrontMost is "Terminal" then
            set bounds of window 1 to {¬
                round ((screenWidth - windowWidth) / 2) rounding as taught in school, ¬
                round ((screenHeight - windowHeight) / 2) rounding as taught in school, ¬
                round ((screenWidth + windowWidth) / 2) rounding as taught in school, ¬
                round ((screenHeight + windowHeight) / 2) rounding as taught in school}
        else
            set bounds of window 1 to {¬
                round ((screenWidth - windowWidth) / 2) rounding as taught in school, ¬
                round ((screenHeight - windowHeight) / 2) rounding as taught in school, ¬
                round ((screenWidth + windowWidth) / 2) rounding as taught in school, ¬
                round ((screenHeight + windowHeight) / 2) rounding as taught in school}
        end if

        set the result to bounds of window 1

    end tell
end try

return input

fin de course

LesApples.com

LesApples est une communauté de Apple où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres utilisateurs d'appareils Apple, poser vos propres questions ou résoudre celles des autres.

Powered by:

X