Dear pywin32 group:

Recently i bump into a case where i cannot get text from a window field 
directly.
So i try to type ctrl+a and ctrl+c , and then use win32clipboard to read data 
from clipboard
However, i always get data from the previous "ctrl+a ctrl+c", not the latest one
In order to get the latest clipboard data , i have to perform "ctrl+a ctrl+c" 
in another thread
Should this be a bug?

FYI ,I'm using Windows10 , Python 3.6.4rc1
def chooseAndCopyResult(app,windowName,editIdx):        allEdits = 
app.window(title_re='.*{}.*'.format(windowName)).children(control_type='Edit')  
     allEdits[editIdx].set_focus().type_keys('^A').type_keys('^C') #this one 
does not return the latest clipboard but the previous clipboard def 
readResultFromOCR(app,windowName,editIdx):  
chooseAndCopyResult(app,windowName,editIdx)     win32clipboard.OpenClipboard()  
data = win32clipboard.GetClipboardData()        win32clipboard.CloseClipboard() 
        return data # this one works, and get the latest data from clipboard 
def readResultFromOCRWorking(app,windowName,editIdx):      thread = 
Thread(target=chooseAndCopyResult,args=(app,windowName,editIdx))       
thread.start()  thread.join()   win32clipboard.OpenClipboard()  data = 
win32clipboard.GetClipboardData()        win32clipboard.CloseClipboard()        
 return data
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to