Скрипт для замены фона экрана при старте.

Created by Stormen (Stormen81 AT gmail DOT com) on June 14, 2007
Modified by morespace on November 15, 2007 (for Mac OS 10.5)

-- Get current loged in user
tell application "System Events" to set c_user to name of current user

-- Restore default pic or choose a new one
set my_result to display dialog ¬
"Would you like to change the Login Background or restore the default one" with icon 1 buttons {"Restore", "Change"} default button 2

if button returned of my_result is "Restore" then
set chosen_pic to true
set my_choice to "Restore"
set chosen_pic to choose file with prompt "Please select a Background Image for the Login Window:" without invisibles

-- set the image path
set image_path to quoted form of (POSIX path of (chosen_pic as alias))
set ThePic to image_path
set my_choice to "Change"
end if

-- set the shell script for the user
if my_choice is "Restore" then
set myScript_s to " sudo defaults delete /Library/Preferences/com.apple.loginwindow \\DesktopPicture"
set myScript_s to "sudo defaults write /Library/Preferences/com.apple.loginwindow \\DesktopPicture " & ThePic
end if

-- user must enter the root password for the shell
set inpwd to display dialog "Enter Root password " default answer "" with icon 2 with hidden answer

if inpwd is not false then
-- set the user password
set pwd to text returned of inpwd
-- run the shell command
do shell script myScript_s password pwd with administrator privileges
--end if
end if

--Log Out prompt
set my_result to display dialog "Done!" & return & "Would you like to Log Out immediately?" with icon 2 buttons {"Cancel", "Log Out"} default button 2

if button returned of my_result is "Log Out" then
tell application "System Events"
keystroke "q" using command down & shift down & option down -- Log Out

end tell
end if

Он же в аттаче

Tags for tips: