title: Python, Pyautogui, and CTRL-C
body: <p>I am attempting to complete a simple process of opening a web/browser based document, selecting a field within said document, and then copying it so that it goes into my operating system's clipboard. Here's the specs :</p>
  
  <p>Windows 7
  Google Chrome ( latest stable ) 
  Python 3.5
  pyautogui for keyboard/mouse control</p>
  
  <p>Here is the field I am trying to work with ( <a href="http://screencast.com/t/jt0kTagb" rel="noreferrer">http://screencast.com/t/jt0kTagb</a> ). When that little arrow is clicked it pops open to reveal a calendar to pick a date. If you click directly in the field instead it highlights the field's contents. When I manually press CTRL+C in this situation the field's contents go right into the clipboard as expected.</p>
  
  <p>I've tried two methods of getting the field to go into my clipboard. The first was leveraging pyautogui's keyDown/up and press functions which essentially looked like :</p>
  
  <pre><code>imageCoord = noClick("img/date.png")
  x, y = pyautogui.center(imageCoord)
  pyautogui.click(x, y + 20)
  pyautogui.keyDown('ctrl')
  pyautogui.press('c')
  pyautogui.keyUp('ctrl')
  </code></pre>
  
  <p>I then attempted to just use the app menu that appears if you right click on something which looked like this:</p>
  
  <pre><code>imageCoord = noClick("img/date.png")
  x, y = pyautogui.center(imageCoord)
  pyautogui.click(x, y + 20, button='right')
  pyautogui.press("down", presses=2)
  time.sleep(1)
  pyautogui.press('enter')
  </code></pre>
  
  <p>Lastly I tried the pyautogui.hotkey() function which looked like this : </p>
  
  <pre><code>imageCoord = noClick("img/date.png")
  x, y = pyautogui.center(imageCoord)
  pyautogui.click(x, y + 20, button='right')
  pyautogui.hotKey('ctrl', 'c')
  </code></pre>
  
  <p>In all three events the field is indeed selected and as best as I can tell the keypresses are going through as all other presses/functions that happen prior go off without a hitch. </p>
  
  <p>The problem that I am facing is that when I do this manually in the same fashion as both of those scripts above I am able to get the contents. When I use the scripts, the clipboard is never updated/populated with the field's contents. Is there something I am overlooking or not considering when working with Python and Window's clipboard?</p>
  
  <p>In the end all I am trying to do is put that value into an excel sheet. Any advice would be appreciated!</p>