I am trying to automate a task of copying data from excel to another application based on a "tagname" column that exists in both. I'm having Python copy the "tagname" and save it to a variable for each ("metertag" and "exceltag"). I've thrown up a tkMessageBox right before the compare to confirm the values are the same (and they are), but my if statement is not being executed, the else is. My question is: does python treat excel formatted text differently from other copied texts? (How would I fix that?) Otherwise what else could be the problem?
click(573,745)
time.sleep(.3)
click_hold(625,357)
win32api.SetCursorPos((571,357))
click_release(571,357)
CTCopy()
time.sleep(.3)
click(1116,264)
win32clipboard.OpenClipboard()
metertag = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
time.sleep(.1)
click(2295, 252) #top of tags excel
time.sleep(1)
click(2295, 252) #top of tags excel
time.sleep(1)
for x in range (0,499):
CTCopy()
win32clipboard.OpenClipboard()
exceltag = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
time.sleep(.02)
metertag = str(metertag)
exceltag = str(exceltag)
TS(metertag,exceltag)
if metertag == exceltag: #<-- this is not true even when I know it is!!?
time.sleep(.25)
press('left_arrow')
time.sleep(.25)
press('left_arrow')
CTCopy()
click(1005,747) #"enter reading" button for updating reading
time.sleep(.75)
click(771,580) #text box for reading update
time.sleep(.05)
CTPaste()
time.sleep(.05)
time.sleep(.05)
click(913,580) #"update now" button
#need case when pop-up occurs
break
else:
press('down_arrow')