앱이 시작될 때 Box SimpleShare 기본 설정 창을 숨기려면 어떻게 해야 합니까?

앱이 시작될 때 Box SimpleShare 기본 설정 창을 숨기려면 어떻게 해야 합니까?

나는박스 심플쉐어앱은 로그인 시 시작되지만 앱은 메뉴 표시줄에 아이콘을 로드한 직후에 기본 설정 창을 시작합니다. "숨겨진" 모드에서 시작하도록 설정 시스템 환경설정 > 사용자 및 그룹 > 로그인 항목그 행동은 바뀌지 않습니다.

앱으로 저장된 AppleScript를 생성하여 실행하려고 했습니다.박스 심플쉐어로그인 시 앱을 실행하고 기본 설정 창을 숨겼지만 예상대로 작동하지 않습니다.

set tApp to "Box SimpleShare"
tell application tApp to launch
tell application "System Events"
    set visible of process "Box SimpleShare" to false
end tell

앱이 실행되지만 닫히지는 않습니다.박스 심플쉐어환경 설정 창. 이를 수행하는 데 적합한 코드는 무엇입니까?

환경 설정 창의 스크린샷

답변1

Box의 기본 설정 창은 특히 지속적인 창입니다. 애플리케이션이 시작될 때마다 표시하도록 요구할 뿐만 아니라 앱이 초기화 시퀀스를 완료하기 전에 닫히면 다시 열립니다! 그러나 일부 GUI 스크립팅을 사용하면~이다없애는 것이 가능합니다. 다음 코드는 애플리케이션을 실행하고 기본 설정 창이 나타날 때까지 기다렸다가 잠시 후에 닫습니다(초기화 시퀀스를 완료할 수 있도록).

property timeOutMax : 5
property timeOutStep : 1
property boxLoadDelay : 2

set boxApp to "Box SimpleShare"
tell application boxApp to launch
set timeOutCounter to 0
tell application "System Events"
    tell process boxApp
        repeat while (window 1 of it exists) is false and timeOutCounter is less than timeOutMax
            delay timeOutStep
            set timeOutCounter to timeOutCounter + timeOutStep
        end repeat
        if window 1 of it exists then
            delay boxLoadDelay
            click (button 1 of window 1 of it)
        end if
    end tell
end tell

시스템에서 창이 다시 열리면 에 더 높은 값을 설정하십시오 boxLoadDelay. 또한 응용 프로그램이 로드되기 전에 스크립트 시간이 초과되면 값을 조정합니다 ( 훨씬 더 높은 시간 초과 임계값을 선택해야 하는 경우 timeOutMax가능 ).timeOutStep

관련 정보