title: Get file location and names from Windows Camera
body: <p>I was running into troubles using <code>QCamera</code> with focusing and other things, so I thought I can use the Camerasoftware served with <code>Windows 10</code>. Based on the thread of <a href="https://stackoverflow.com/questions/56523525/open-windows-camera-from-python-application">opening the Windows Camera</a> I did some trials to aquire the taken images and use them for my program. In the <a href="https://github.com/microsoft/Windows-Camera" rel="nofollow noreferrer">documentation</a> and its API I didn't find usable snippets (for me), so I created the hack mentioned below. It assumes that the images are in the <strong>target folder</strong> <code>'C:\\Users\\*username*\\Pictures\\Camera Roll'</code> which is mentioned in the registry (See below), but I don't know if this is reliable or how to get the proper key name.
  I don't think that this is the only and cleanest solution. So, my question is how to get taken images and open/close the Camera proper?
  Actualy the function waits till the <code>'WindowsCamera.exe'</code> has left the processlist and return newly added images / videos in the <strong>target folder</strong></p>
  <p>In the registry I found:</p>
  <p>Entry: <code>Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders</code> with key name <code>{3B193882-D3AD-4eab-965A-69829D1FB59F}</code>for the <strong>target folder</strong>. I don't think that this key is usable.</p>
  <h2>Working example of my hack:</h2>
  <pre><code>import subprocess
  import pathlib
  import psutil
  
  def check_for_files(path, pattern):
      print(&quot; check_for_files:&quot;, (path, pattern))
      files = []
      for filename in pathlib.Path(path).rglob(pattern):
          files.append (filename)
      return files
  
  def get_Windows_Picture(picpath):
      prefiles = check_for_files(picpath, '*.jpg')
      x = subprocess.call('start microsoft.windows.camera:',  shell=True)
      processlist = [proc.info['name'] for proc in psutil.process_iter (['name'])]
      while 'WindowsCamera.exe' in processlist:
          processlist = [proc.info['name'] for proc in psutil.process_iter (['name'])]
      postfiles = check_for_files(picpath, '*.jpg')
      newfiles = []
      for file in postfiles:
          if file not in prefiles:
              newfiles.append(str(file))
      return newfiles
  if __name__ == &quot;__main__&quot;:
      picpath = str (pathlib.Path (&quot;C:/Users/*user*/Pictures/Camera Roll&quot;))
      images = get_Windows_Picture(picpath)
      print(&quot;Images:&quot;, images)
  </code></pre>