Skip to content

Instantly share code, notes, and snippets.

@itbj
Forked from OKsign/script 21.txt
Created October 27, 2018 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itbj/022c5b8676b05a87e98fac2fa2ff51a9 to your computer and use it in GitHub Desktop.
Save itbj/022c5b8676b05a87e98fac2fa2ff51a9 to your computer and use it in GitHub Desktop.
-- user input - mode
set mode to 2 -- (2 or 3 or 4) if mode is 2, pic1 and pic2 will be used | if mode is 3, pic1,pic2 and pic3 will be used.
-- user input - pics
set pic1 to ""
set pic2 to ""
set pic3 to ""
set pic4 to ""
-- end of user input
if mode is greater than or equal to 2 then
if mode is not greater than 4 then
-- do it
-- mode is 2
if mode is 2 then
if pic1 is "" or pic2 is "" then
display dialog "Please set pic in user input." with title "Script 21"
return
else
set pic1p to POSIX file pic1
set pic2p to POSIX file pic2
end if
tell application "System Events"
tell current desktop
set c to picture
end tell
end tell
if c is pic1 then
tell application "System Events"
tell current desktop
set picture to pic2p
return
end tell
end tell
end if
if c is pic2 or c is not pic2 then
tell application "System Events"
tell current desktop
set picture to pic1p
return
end tell
end tell
end if
end if -- mode is 2
-- end - mode is 2
-- mode is 3
if mode is 3 then
if pic1 is "" or pic2 is "" or pic3 is "" then
display dialog "Please set pic in user input." with title "Script 21"
return
else
set pic1p to POSIX file pic1
set pic2p to POSIX file pic2
set pic3p to POSIX file pic3
end if
tell application "System Events"
tell current desktop
set c to picture
end tell
end tell
if c is pic1 then
tell application "System Events"
tell current desktop
set picture to pic2p
return
end tell
end tell
end if
if c is pic2 then
tell application "System Events"
tell current desktop
set picture to pic3p
return
end tell
end tell
end if
if c is pic3 or c is not pic3 then
tell application "System Events"
tell current desktop
set picture to pic1p
return
end tell
end tell
end if
end if -- mode is 3
-- end - mode is 3
-- mode is 4
if mode is 4 then
if pic1 is "" or pic2 is "" or pic3 is "" or pic4 is "" then
display dialog "Please set pic in user input." with title "Script 21"
return
else
set pic1p to POSIX file pic1
set pic2p to POSIX file pic2
set pic3p to POSIX file pic3
set pic4p to POSIX file pic4
end if
tell application "System Events"
tell current desktop
set c to picture
end tell
end tell
if c is pic1 then
tell application "System Events"
tell current desktop
set picture to pic2p
return
end tell
end tell
end if
if c is pic2 then
tell application "System Events"
tell current desktop
set picture to pic3p
return
end tell
end tell
end if
if c is pic3 then
tell application "System Events"
tell current desktop
set picture to pic4p
return
end tell
end tell
end if
if c is pic4 then
tell application "System Events"
tell current desktop
set picture to pic1p
return
end tell
end tell
end if
end if -- mode is 4
-- end - mode is 4
else
display dialog "Please set mode in user input (2 or 3 or 4)." with title "Script 21"
return
end if
else
display dialog "Please set mode in user input (2 or 3 or 4)." with title "Script 21"
return
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment