title: How do you reload files in mac preview 10.7?
body: <p>I'd like to reload files (.png, .pdf) in Preview after they have been updated.  How can this be accomplished?</p>
  
  <p>In OS X 10.5 and 10.6, it was as simple as switching to Preview - it would automatically reload the new file.  Alternatively, you could use <code>open -a Preview *.png</code> or something similar. In 10.7, auto-reloading doesn't work (see <a href="https://apple.stackexchange.com/questions/33848/preview-in-lion-fails-when-any-document-opened-has-changed">this post</a>).</p>
  
  <p>My first attempt is an applescript script run from the command line:</p>
  
  <pre><code>/usr/bin/osascript -e 'tell application "Preview.app" to activate
      tell application "Preview.app" to open "'$PWD/$*'"' 
  </code></pre>
  
  <p>This works for a single file, but fails with multiple files for obvious reasons.  I did a little more research and tried using a more complicated applescript involving <code>set</code> and a list, but this results in permissions errors:</p>
  
  <p><img src="https://i.stack.imgur.com/NoZdQ.png" alt="errors seen when using advanced script"></p>
  
  <p>Here's the python script I used (my bash scripting skills were not up to the task of string parsing):</p>
  
  <pre><code>#!/usr/bin/env python
  
  import optparse
  import os
  
  parser=optparse.OptionParser()
  options,args = parser.parse_args()
  
  pwd = os.getcwd()
  
  cmd = '/usr/bin/osascript -e '
  scriptcmd = "tell application \"Preview.app\" to activate\n" 
  
  flist = [ fn  if fn[0]=='/' else pwd+"/"+fn  for fn in args]
  
  scriptcmd += "set myList to {\"%s\"}\n" % ( '","'.join(flist) )
  
  scriptcmd += "tell application \"Preview.app\" to open myList"
  
  print("%s \'%s\'" % (cmd,scriptcmd))
  
  os.system("%s \'%s\'" % (cmd,scriptcmd))
  </code></pre>
  
  <p>I'm not even sure this script would have solved my original problem - reloading images without seeing a gray screen - but I'd like to know if there's any way to simply open a list of files with <code>osascript</code> instead of <code>open</code>.</p>
  
  <p>EDIT: Attempted to fix applescript, but this code gets "missing value" errors:</p>
  
  <pre><code>tell application "Preview.app" to activate
  set myListOfImages to {":Users:adam:work:code:test.png"} 
  tell application "Preview.app" to open myListOfImages
  </code></pre>