2013-08-08 1 views
1

AppleScript를 사용하여 시스템 환경 설정에서 실제 윈도우가 열리지 않고 "원격 로그인"을 활성화하는 스크립트를 만듭니다.'시스템 환경 설정'에서 설정을 편집하기 위해 AppleScript 만들기

tell application "System Events" to set visible of process "System Preferences" to false 
: 같은

tell application "System Preferences" to launch 
tell application "System Preferences" to set current pane to pane "com.apple.preferences.sharing" 
tell application "System Events" to set visible of process "System Preferences" to false 
tell application "System Events" to tell process "System Preferences" 
    click checkbox 1 of row 5 of table 1 of scroll area 1 of group 1 of window "Sharing" 
    tell application "System Preferences" 
     quit 
    end tell 
end tell 

내가 시도 다양한 라인 : 아래

그러므로 내가이 일을 정확히 볼 수 작업 여전히 시스템 환경 설정 창을 엽니 다 내 코드입니다

하지만 여전히 내가 원하는 결과를주지 않습니다.

내 질문은이 프로세스를 수행하는 동안 창을 숨길 수있는 줄을 쓸 수 있습니까? 감사.

답변

1
당신은 시스템 환경 설정을 열고 피할 수

, 당신은 쉘에서 SSH (원격 로그인)을 시작할 수 있습니다, 그래서 애플 스크립트 명령은 다음과 같습니다

do shell script "launchctl load -w /System/Library/LaunchDaemons/ssh.plist" user name (short user name of (system info)) password "currentuserpasssord" with administrator privileges 

는 현재 사용자의 암호를 사용하여 currentuserpassword를 교체하는 것이 관리자가되어야합니다.

+0

완벽하고 좋은 방법입니다. 고맙습니다. – l00kitsjake

관련 문제