AppleScript 예제

이 예제 스크립트는 컴퓨터 그룹을 빠르게 정리할 때 사용될 수 있습니다.

먼저 방해받지 않도록 컴퓨터 화면을 잠급니다. 그 다음 클라이언트 컴퓨터에서 현재 활성 상태인 데스크탑에 남아 있는 모든 항목을 삭제합니다. 마지막으로 클라이언트의 휴지통을 비우고 화면의 잠금을 해제하여 완료합니다.

경고: 이 예제 스크립트는 교육용으로만 사용될 수 있고 각 컴퓨팅 환경에 대한 이 스크립트의 적합성에 대해 명시적 또는 함축적인 보증은 없습니다. 이 스크립트는 대상 컴퓨터에 있는 항목도 삭제합니다. 그에 따른 책임은 사용자에게 있습니다.

-- Start commanding the local copy of Remote Desktop tell application "Remote Desktop" -- decide which list to perform this on, -- in this case it's called "Classroom" set these_computers to computer list "Classroom" -- decide what locked screen text you want displayed set screen_message to "Please wait" as Unicode text -- make a UNIX script which executes an AppleScript on the remote computers set the UNIX_script to ¬ "osascript -e 'tell application "Finder" to move " & ¬ "(every item of the desktop whose class isn't disk) to the trash'" -- set the lock task parameters set lock_task to make new lock screen task with properties ¬ {name:"Lock Classroom", message:screen_message} -- perform the task execute lock_task on these_computers -- set the UNIX script parameters set clean_task to make new send unix command task with properties ¬ {name:"Clean Desktop", showing output:false, script:UNIX_script} -- perform the task execute clean_task on these_computers -- empty the Trash afterward execute (make new empty trash task) on these_computers -- unlock the screen when finished execute (make new unlock screen task) on these_computersend tell