Remote Desktopの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