title: Using Applescript to Change desktop icon size
body: <p>I am currently using applescript to setup various parameters of the desktops at my university. So far my script successfully changes the desktop background and the dock size.</p>
  
  <p>The problem at hand is when I run the script, majority of the time, the icons on the desktop never change. </p>
  
  <p>Here is the script I wrote to alter the desktop icon's size and grid spacing:</p>
  
  <pre><code>tell application "System Events"
      set finderPrefsFile to property list file "~/Library/Preferences/com.apple.Finder.plist"
      tell finderPrefsFile
          tell property list item "DesktopViewSettings"
              tell property list item "IconViewSettings"
                  set value of property list item "gridSpacing" to "100"
                  set value of property list item "iconSize" to "32"
                  set value of property list item "arrangeBy" to "none"
              end tell
          end tell
      end tell
  end tell
  #Restart Finder for changes to take effect.
  do shell script "killall Finder"
  </code></pre>
  
  <p>How should I go about altering the script to make it work all the time (I would like to eventually share this script with some of my classmates). </p>
  
  <p>P.s.
  <a href="https://paste.ee/p/PtsO6" rel="nofollow">Here is the full script</a></p>