

# https://www.globalsino.com/ICs/page4853.html
# Copy text into clipboard and then you can paste it a webpage automatically

import time
import sys
import os
from datetime import date

sys.path.append(os.path.abspath('Yes'))

import pyperclip

today = date.today()
d1 = today.strftime("%d/%m/%Y")

recent_value = ""

while True:
  tmp_value = pyperclip.paste()
  if tmp_value != recent_value:
    recent_value = tmp_value
    print("Value changed: %s" % str(recent_value)[:20])
    with open ('C:\GlobalSino\images\clipboard_to_webpage.html', '+a') as output:
      try:
        output.write("..........................." +d1+"..............................................................................................................")
        output.write("%s\n"% str(tmp_value))
      except:
        output.write("....." +d1+"....")
        output.write("%s\n"% str(tmp_value.encode("UTF_8")))
        output.write("")
  time.sleep(0.1)
        



