AppleScript 응용 프로그램에서 키 입력을 보낼 수 없습니다.

WeeeHaaa

FRIDAY라는 AppleScript로 앱을 만들었습니다. 내가 '크롬 열기'라고 말하면 Google 크롬이 열리고 스크립트 편집기와 스크립트 편집기 외부에서 작동합니다. 또한 '새 탭 열기'라고 말하면 키 입력을 사용하여 새 탭이 열립니다.

-- this boolean is the reason this script keeps runing
set condition to false
say "Welcome sir"
set commands to {"what is todays date", "what time is it", "what is the time", "what day is it", "what month is it", "which month is it", "friday you up", "friday", "friday you tere", "you there", "empty the trash", "take out the trash", "clean up", "new tab", "next tab", "back", "take a nap", "go to sleep", "take a rest", "wake up", "copy the link", "paste the link", "give me list of running apps", "open a folder", "open chrome", "open youtube", "open atom", "quit atom", "goodbye FRIDAY_AI", "okay thanks", "okay thank you", "thanks", "thank you", "good night", "good morning", "morning", "night", "hey friday"}
repeat until condition is true
    try
        tell application "SpeechRecognitionServer"
            set FRIDAY_AI to listen continuously for commands with identifier "mine" with section title "FRIDAY's Commands"
        end tell

    -- full date
    set todays_date to date string of (current date)
    -- day
    set todays_day to weekday of (current date) as string
    -- time
    set t to time string of (current date)
    -- month
    set m to month of (current date) as string


    -- time and day
    if FRIDAY_AI = "what is todays date" then
        say todays_date
    end if
    if FRIDAY_AI = "what time is it" then
        say t
    end if
    if FRIDAY_AI = "what is the time" then
        say t
    end if
    if FRIDAY_AI = "what day is it" then
        say todays_day
    end if
    if FRIDAY_AI = "what month is it" then
        say m
    end if
    if FRIDAY_AI = "which month is it" then
        say m
    end if
    -- end of time and day


    -- Clear trash --
    if FRIDAY_AI = "empty the trash" then
        tell application "Finder"
            empty the trash
        end tell
    end if

    -- FRIDAY --
    if FRIDAY_AI = "friday" then
        say "yes"
    end if

    if FRIDAY_AI = "friday you up" then
        say "for you sir, alllways"
    end if

    if FRIDAY_AI = "friday you there" then
        say "yes"
    end if

    if FRIDAY_AI = "you there" then
        say "yes"
    end if

    if FRIDAY_AI = "hey friday" then
        say "hey sir, waht can I do for you"
    end if
    -- END OF FRIDAY --


    if FRIDAY_AI = "take out the trash" then
        tell application "Finder"
            empty the trash
        end tell
    end if
    -- end of clear trash --

    -- QUITS EVERY APPLICATION --
    if FRIDAY_AI = "clean up" then
        say "cleaning up"
        delay 2
        say "goodbye sir"
        tell application "System Events" to set the visible of every process to true

        set white_list to {"Finder"}

        try
            tell application "Finder"
                set process_list to the name of every process whose visible is true
            end tell
            repeat with i from 1 to (number of items in process_list)
                set this_process to item i of the process_list
                if this_process is not in white_list then
                    tell application this_process
                        quit
                    end tell
                end if
            end repeat
        on error
            tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
        end try
    end if
    -------------------------------------


    -- SWITCH BETWEEN TABS TABS --
    if FRIDAY_AI = "new tab" then
        tell application "System Events"
            key code 17 using {command down}
        end tell
    end if
    --next tab --
    if FRIDAY_AI = "next tab" then
        tell application "System Events"
            key code 48 using {control down}
        end tell
    end if
    -- priveus tab --
    if FRIDAY_AI = "back" then
        tell application "System Events"
            key code 48 using {shift down, control down}
        end tell
    end if
    -- END OF SWITCH BETWEEN TABS --




    -- launches screen saver  
    if FRIDAY_AI = "take a nap" then
        try
            tell application id "com.apple.ScreenSaver.Engine" to launch
        end try
    end if
    if FRIDAY_AI = "go to sleep" then
        try
            tell application id "com.apple.ScreenSaver.Engine" to launch
        end try
    end if
    if FRIDAY_AI = "take a rest" then
        try
            tell application id "com.apple.ScreenSaver.Engine" to launch
        end try
    end if

    if FRIDAY_AI = "wake up" then
        tell application "System Events"
            key code 49
        end tell
    end if
    -- END OF SCREEN SAVER --





    if FRIDAY_AI = "give me list of running apps" then
        tell application "System Events"
            key code 53 using {command down, option down}
        end tell
    end if



    -- copy url --
    if FRIDAY_AI = "copy the link" then
        tell application "System Events"
            key code 37 using {command down}
            delay 0.5
            key code 8 using {command down}
        end tell
    end if

    -- paste url --
    if FRIDAY_AI = "paste the link" then
        tell application "System Events"
            key code 37 using {command down}
            delay 0.5
            key code 9 using {command down}
            keystroke return
        end tell
    end if




    if FRIDAY_AI = "open a folder" then
        log FRIDAY_AI
        tell application "Finder"
            activate
            make new Finder window
            set target of front window to home
        end tell
    end if

    if FRIDAY_AI = "open chrome" then
        tell application "Google Chrome"
            log FRIDAY_AI
            say "Opening Google Chrome sir"
            activate
        end tell
    end if

    (* if FRIDAY_AI = "open atom" then
    tell application "Atom"
        log FRIDAY_AI
        say "opening Atom"
        activate
    end tell
end if 

if FRIDAY_AI = "quit atom" then
    log FRIDAY_AI
    tell application "Atom" to quit
end if *)

    if FRIDAY_AI = "goodbye FRIDAY_AI" then
        log FRIDAY_AI
        say "goodbye sir"
        -- quit = exist the program completely--
        -- Stop the script- -
        exit repeat
    end if

    if FRIDAY_AI = "open youtube" then
        log FRIDAY_AI
        tell application "Google Chrome"
            activate
            open location "https://www.youtube.com/"
        end tell
    end if

    -- JUST PERSONAL COMMENTARY --
    if FRIDAY_AI = "thanks" then
        log FRIDAY_AI
        say "I am glad, I could be of help sir"
    end if

    if FRIDAY_AI = "okay thanks" then
        log FRIDAY_AI
        say "I am glad, I could be of help sir"
    end if

    if FRIDAY_AI = "thank you" then
        log FRIDAY_AI
        say "You're welcome sir"
    end if

    if FRIDAY_AI = "okay thank you" then
        log FRIDAY_AI
        say "You're welcome sir"
    end if

    if FRIDAY_AI = "good night" then
        log FRIDAY_AI
        say "Good night sir"
    end if

    if FRIDAY_AI = "night" then
        log FRIDAY_AI
        say "Good night sir"
    end if

    if FRIDAY_AI = "good morning" then
        log FRIDAY_AI
        say "Good morning sir"
    end if

    if FRIDAY_AI = "morning" then
        log FRIDAY_AI
        say "morning sir"
    end if

    -- END OF PERSONAL COMMENTARY --
    -- if an error occurs, it goes back and keep repeating
    on error
        set condition to false
    end try


end repeat

이제 위의 코드는 Script Editor에서 FRIDAY를 실행할 때만 작동하지만 FRIDAY를 응용 프로그램으로 저장하고 실행하면 작동하지 않습니다.

Script Editor와 내 응용 프로그램 (FRIDAY)에는 접근성이 있으며 실제로 FRIDAY에는 전체 디스크 접근성이 있습니다. 그러나 여전히 키 입력을 보낼 수 없습니다.

이 오류가 계속 발생합니다.

시스템 이벤트에 오류가 발생했습니다. FRIDAY는 키 입력을 보낼 수 없습니다.

접근성 : 여기에 이미지 설명 입력전체 디스크 액세스 : 여기에 이미지 설명 입력자동화 :여기에 이미지 설명 입력

이 문제를 해결하도록 도와 주시면 정말 감사하겠습니다. 감사합니다!

테드 류

macOS 10.15 Catalina로 업데이트 할 때 비슷한 문제가 발생했습니다. 시스템 환경 설정-> 보안 및 개인 정보-> 접근성으로 이동하여 여기에서 내 응용 프로그램을 삭제 한 다음 다시 추가했습니다. 그 후 모든 것이 완벽하게 작동합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Win32에서 단일 응용 프로그램에 키보드 입력을 연결할 수 있습니까?

grails 응용 프로그램에서 더 이상 localhost에서 이메일을 보낼 수 없습니다.

xamarin에서 요청을 보낼 수 없지만 WPF 응용 프로그램에서 요청을 보낼 수 있습니다.

활성 창에 관계없이 응용 프로그램에서 키 입력을 얻을 수 있습니까?

모든 응용 프로그램에서 Automator를 통해 Applescript에서 키 입력 보내기

MVC 응용 프로그램은 로컬 HMailServer를 통해 메일을 보낼 수 없습니다.

쿠키없는 웹 응용 프로그램에서 asp.net 세션을 생성 할 수 없습니다.

Applescript는 응용 프로그램 설치 중에 sed를 찾을 수 없습니다.

단일 키를 수정 자로 사용하고 일반 키 입력을 보낼 수 있습니까?

Xubuntu의 "키보드"설정에서 단일 사용자 정의 키보드 단축키로 여러 응용 프로그램을 시작할 수 있습니까?

셀레늄은 입력 상자에 키를 보낼 수 없습니다

표준 입력이 다른 경우 Go 프로그램이 키보드에서 읽을 수 있습니까?

eGalax 장치에서 QtQuick 응용 프로그램으로 터치 입력을받을 수 없습니다.

Windows 보안 센터에서 응용 프로그램을 등록 할 수 없습니다.

하위 프로세스를 사용하여 파이썬을 사용하여 다른 프로그램에 입력을 어떻게 보낼 수 있습니까?

응답으로 파일을 보낼 수 없습니다.

두 개의 다른 응용 프로그램에 출력을 지정하는 동안 두 개의 키보드를 동시에 사용할 수 있습니까?

Python3의 특정 응용 프로그램에 키 입력을 보내는 방법이 있습니까?

콘솔 응용 프로그램에 항상 집중하지 않고 키보드 입력을 읽습니까?

Safari에서 웹 페이지에 키 입력을 보낼 수 있습니까?

Angular 6 응용 프로그램에서 Web API로 이미지 파일과 함께 FormData를 보낼 수 있다는 것입니다.

Spartacus 응용 프로그램에서 번역을 사용할 수 없습니다.

Xcode 6에서 개인 프레임 워크가 "응용 프로그램 패키지를 검사 할 수 없음"이있는 응용 프로그램입니다. 프레임 워크 info.plist가 없습니다.

Java에서 AutoItX를 사용하여 키를 보낼 수 없습니다.

RakNet (C ++)에서 서버 응용 프로그램을 만들 수 없습니다.

Steam 및 몇 가지 다른 프로그램에서 키 입력을받을 수 없습니다.

Java 응용 프로그램에서 Graalvm을 찾을 수 없습니다.

오류 : VSCode에서 Flask 응용 프로그램을 찾을 수 없습니다.

응용 프로그램에서 내 .ico 파일을 찾을 수 없습니다.