xingxing_get_station_name_pic.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # -*- coding: utf-8 -*-
  2. # !/usr/bin/env python
  3. import os, sys,time,datetime
  4. import urllib
  5. import requests
  6. from mongoengine import register_connection, PointField, DynamicDocument, StringField
  7. import simplejson as json
  8. from django.db.models.fields import DateTimeField
  9. PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
  10. sys.path.insert(0, PROJECT_ROOT)
  11. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "configs.testing")
  12. from script.base import init_env
  13. init_env(interactive = False)
  14. from apps.web.core.db import Searchable
  15. import pyautogui
  16. # 首先输入访问设备的URL
  17. def send_url_for_dev(device_id):
  18. time.sleep(1)
  19. # x, y = pyautogui.position()
  20. # print x,y
  21. pyautogui.moveTo(1057,798)
  22. pyautogui.click()
  23. time.sleep(0.1)
  24. pyautogui.hotkey('ctrlleft', 'a')
  25. time.sleep(0.1)
  26. pyautogui.press('backspace')
  27. time.sleep(0.1)
  28. pyautogui.typewrite(message='http://hzchaotiankj.com/weixin/payone?num=%s' % device_id)
  29. time.sleep(0.1)
  30. pyautogui.hotkey('altleft', 's')
  31. time.sleep(0.1)
  32. pyautogui.moveTo(1112,630)
  33. pyautogui.click()
  34. time.sleep(5)
  35. pyautogui.moveTo(1260,129)
  36. time.sleep(0.2)
  37. pyautogui.click()
  38. # while True:
  39. # print pyautogui.position()
  40. # time.sleep(1)
  41. time.sleep(1)
  42. ii = 0
  43. while True:
  44. pyautogui.moveTo(987,574)
  45. file1 = pyautogui.screenshot(region=(766,220,412,575))
  46. file1.save(u'Q:/友商信息/汽车桩/星星充电/站列表截图/%s.png' % int(time.time()*1000))
  47. ii += 1
  48. print ii
  49. pyautogui.scroll(-400)
  50. time.sleep(0.2)
  51. print 'OK'