Sidehistorik
...
The folder where images are stored are in osx "/Users/npn/Dropbox/Wallpapers" - which in AppleScript becomes "Macintosh HD:Users:npn:Dropbox:Wallpapers" and this is more or less hardcoded in the script.
...
; only the username of the logged in user is dynamic.
iTerm2.app
The script itself for "iTerm2":
Kodeblok |
---|
on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars set userName to short user name of (system info) as text set wallPaperPath to "Macintosh HD:Users:" & userName & ":Dropbox:Wallpapers" as text tell application "Finder" set randomImage to some file of folder "Macintosh HD:Users:npn:Dropbox:Wallpapers"wallPaperPath end tell set thePath to replace_chars(randomImage as string, ":", "/") set thePath to replace_chars(thePath,"Macintosh HD","") tell application "iTerm2" tell current session of current window set background image to thePath end tell end tell |