Random Wallpaper

This was a simple script I made a while ago, and recently, I made it better and faster. It changes my desktop wallpaper to a random wallpaper in my collection (I’m a fan of wallpaper, which is why I made this). It picks a random number, which becomes the random wallpaper chosen from my Wallpaper folder. I also have a folder in my Wallpaper folder called Apple Wallpapers, which are just a few of my favorite Apple wallpapers.

This is the script I use (the script will automatically detect your startup disk and home folder):

-- current user path
tell application "Finder" to set startupDisk to startup disk as text
set currentUser to (short user name of (system info))

-- set random wallpaper
tell application "Finder"
	-- sets the chance the Apple wallpaper folder is chosen
	set randNum to random number from 1 to 100
	if randNum > 10 then
		set WPfolder to folder ("" & startupDisk & "Users:" & currentUser & ":Pictures:Wallpaper:")
	else if randNum ≤ 10 then
		set WPfolder to folder ("" & startupDisk & "Users:" & currentUser & ":Pictures:Wallpaper:Apple Wallpaper:")
	end if
	-- picks random wallpaper number
	set WPnumber to random number from 1 to (number of files of WPfolder as text)
	set randomWP to file WPnumber of WPfolder
	set desktop picture to randomWP
end tell