Reputation: 1
I found the following script from Change laptop Mac OS X wallpaper upon location but it reads an error when I run it, saying "grep: SSID:: No such file or directory".
set mySSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|grep \" SSID: \"|cut -c 18-"
if mySSID is equal to "NETWORK_NAME" then
tell application "Finder"
set desktop picture to {"Macintosh HD:Users:USER_NAME:Desktop:IMAGE_NAME.jpg"} as alias
end tell
end if
I'm new to Automator and scripts but want to learn and understand why this isn't working.
Upvotes: 0
Views: 240
Reputation: 3105
More clear.
Applescript instructions about space preferences are no longer supported since 10.9.
Also, there is no direct way to set wallpaper on already created spaces. Just for next new spaces, the wallpaper will use same value as space 1.
Work around could be that your script changes the wallpaper in a loop for all existing spaces. In this case, you must define, in system preferences, the keys to switch between spaces, and use keystroke to simulate these keys, then change space and change wallpaper then switch next space and so on. But I have no idea to know how to get the number of spaces currently open !
Upvotes: 0
Reputation: 3105
This could be because your wifi is not connected, then the 'cut' function has nothing to cut. better use this syntaxe which just gives you empty string is case no connection, and SSID name when connected:
set mySSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ SSID: / {print $2}'"
Upvotes: 1