quick_hotkey_ab.py 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. from time import sleep
  2. # from subprocess import check_output
  3. import re
  4. import subprocess as sp
  5. import keyboard as kb
  6. import pyautogui as gui
  7. import pywinctl as gw
  8. sleep_ = 0.025
  9. CONF = 0.8
  10. mentor_user = 'utilizator: Master'
  11. def fill_394():
  12. sp.run('D:/py_scripts/intocmit/repr.py', shell=True)
  13. def fill_S1000():
  14. sp.run('D:/py_scripts/intocmit/int_bil.py', shell=True)
  15. def sign_bil():
  16. sp.run('D:/py_scripts/intocmit/bil_automatition.py', shell=True)
  17. def abbr(short_cut, abbr_message, modifier=''):
  18. shc = short_cut
  19. if shc == ' ':
  20. shc1 = re.findall(' +', shc)
  21. gui.typewrite(abbr_message)
  22. gui.press('left', presses=1, interval=sleep_)
  23. gui.press('backspace', presses=1, interval=sleep_)
  24. gui.press('right', presses=1, interval=sleep_)
  25. else:
  26. shc1 = re.findall('[a-z0-9-]*', shc)
  27. gui.press('backspace', presses=len(''.join(shc1) + modifier), interval=sleep_)
  28. # gui.typewrite(abbr_message, interval=sleep_)
  29. kb.write(abbr_message)
  30. def mv_mouse_right():
  31. size = gui.size()
  32. gui.moveTo(size[0] / 1.01, size[1] / 1.01)
  33. # gui.click()
  34. def mv_mouse_cent():
  35. size = gui.size()
  36. gui.moveTo(size[0] / 2, size[1] / 2)
  37. def _printer(func):
  38. def wrapper():
  39. print(func.__doc__, 'h_key performed')
  40. return func()
  41. return wrapper
  42. @_printer
  43. def remake_journal():
  44. '''refacere jurnal'''
  45. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  46. active_win = gw.getActiveWindow()
  47. # print(active_win)
  48. if mentor_user.upper() in active_win.title.upper():
  49. # # mentor_win.activate()
  50. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/contabile.png', confidence=CONF)
  51. sleep(0.1)
  52. if butt_x_y:
  53. gui.click(butt_x_y[0], butt_x_y[1])
  54. pos_x_y = gui.position()
  55. gui.moveTo(pos_x_y[0], pos_x_y[1])
  56. gui.press('enter')
  57. mv_mouse_cent()
  58. # gui.move(1, 1)
  59. @_printer
  60. def cash_registry():
  61. '''registru de casa'''
  62. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  63. active_win = gw.getActiveWindowTitle()
  64. if mentor_user.upper() in active_win.upper():
  65. # # mentor_win.activate()
  66. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/trezorerie.png', confidence=CONF)
  67. sleep(0.1)
  68. if butt_x_y:
  69. gui.click(butt_x_y[0], butt_x_y[1])
  70. pos_x_y = gui.position()
  71. gui.moveTo(pos_x_y[0], pos_x_y[1])
  72. gui.press('right', 1, sleep_)
  73. gui.press('down', 1, sleep_)
  74. gui.press('return', 1, sleep_)
  75. mv_mouse_cent()
  76. # print('please activate Window LISTE')
  77. @_printer
  78. def clients_ron():
  79. '''clienti datornici'''
  80. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  81. active_win = gw.getActiveWindowTitle()
  82. if mentor_user.title() in active_win.title():
  83. # # mentor_win.activate()
  84. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/parteneri.png', confidence=CONF)
  85. sleep(0.1)
  86. if butt_x_y:
  87. gui.click(butt_x_y[0], butt_x_y[1])
  88. pos_x_y = gui.position()
  89. gui.moveTo(pos_x_y[0], pos_x_y[1])
  90. gui.press('right', 1, sleep_)
  91. gui.press('down', 11, sleep_)
  92. gui.press('return', 2, sleep_)
  93. mv_mouse_cent()
  94. @_printer
  95. def verif_balance():
  96. '''balanta de verificare'''
  97. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  98. active_win = gw.getActiveWindowTitle()
  99. if mentor_user.title() in active_win.title():
  100. # # mentor_win.activate()
  101. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/contabile.png', confidence=CONF)
  102. sleep(0.1)
  103. if butt_x_y:
  104. gui.click(butt_x_y[0], butt_x_y[1])
  105. pos_x_y = gui.position()
  106. gui.moveTo(pos_x_y[0], pos_x_y[1])
  107. gui.press('down', 1, sleep_)
  108. gui.press('right', 1, sleep_)
  109. gui.press('down', 1, sleep_)
  110. gui.press('return', 2, sleep_)
  111. mv_mouse_cent()
  112. @_printer
  113. def suppliers_ron():
  114. '''furnizori neachitati'''
  115. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  116. active_win = gw.getActiveWindowTitle()
  117. if mentor_user.title() in active_win.title():
  118. # # mentor_win.activate()
  119. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/parteneri.png', confidence=CONF)
  120. sleep(0.1)
  121. if butt_x_y:
  122. gui.click(butt_x_y[0], butt_x_y[1])
  123. pos_x_y = gui.position()
  124. gui.moveTo(pos_x_y[0], pos_x_y[1])
  125. # gui.press('down', 1, sleep_)
  126. gui.press('down', 1, sleep_)
  127. gui.press('right', 1, sleep_)
  128. gui.press('down', 9, sleep_)
  129. gui.press('return', 2, sleep_)
  130. mv_mouse_cent()
  131. @_printer
  132. def suppliers_val():
  133. '''furnizori neachitati eur'''
  134. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  135. active_win = gw.getActiveWindowTitle()
  136. if mentor_user.title() in active_win.title():
  137. # # mentor_win.activate()
  138. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/parteneri.png', confidence=CONF)
  139. sleep(0.1)
  140. if butt_x_y:
  141. gui.click(butt_x_y[0], butt_x_y[1])
  142. pos_x_y = gui.position()
  143. gui.moveTo(pos_x_y[0], pos_x_y[1])
  144. gui.press('down', 1, sleep_)
  145. gui.press('right', 1, sleep_)
  146. gui.press('down', 10, sleep_)
  147. gui.press('return', 2, sleep_)
  148. mv_mouse_cent()
  149. @_printer
  150. def bank_registry_ron():
  151. '''registru de banca lei'''
  152. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  153. active_win = gw.getActiveWindowTitle()
  154. if mentor_user.title() in active_win.title():
  155. # # mentor_win.activate()
  156. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/trezorerie.png', confidence=CONF)
  157. sleep(0.1)
  158. if butt_x_y:
  159. gui.click(butt_x_y[0], butt_x_y[1])
  160. pos_x_y = gui.position()
  161. gui.moveTo(pos_x_y[0], pos_x_y[1])
  162. gui.press('down', 4, sleep_)
  163. gui.press('return', 1, sleep_)
  164. mv_mouse_cent()
  165. @_printer
  166. def bank_registry_val():
  167. '''registru de banca val'''
  168. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  169. active_win = gw.getActiveWindowTitle()
  170. if mentor_user.title() in active_win.title():
  171. # # mentor_win.activate()
  172. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/trezorerie.png', confidence=CONF)
  173. sleep(0.1)
  174. if butt_x_y:
  175. gui.click(butt_x_y[0], butt_x_y[1])
  176. pos_x_y = gui.position()
  177. gui.moveTo(pos_x_y[0], pos_x_y[1])
  178. gui.press('down', 6, sleep_)
  179. gui.press('return', 1, sleep_)
  180. mv_mouse_cent()
  181. def close_all_lists():
  182. '''inchide toate ferestrele'''
  183. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  184. active_win = gw.getActiveWindowTitle()
  185. if mentor_user.title() in active_win.title():
  186. # # mentor_win.activate()
  187. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/inchidere.png', confidence=CONF)
  188. sleep(0.1)
  189. if butt_x_y:
  190. gui.click(butt_x_y[0], butt_x_y[1])
  191. pos_x_y = gui.position()
  192. gui.moveTo(pos_x_y[0], pos_x_y[1])
  193. mv_mouse_cent()
  194. @_printer
  195. def h_key14():
  196. '''*****'''
  197. abbr('`+p', r'61103989', modifier='`')
  198. @_printer
  199. def h_key15():
  200. '''*****'''
  201. abbr('`+m+p', r'RM1984ent', modifier='`')
  202. @_printer
  203. def account_details():
  204. '''fisa de cont'''
  205. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  206. active_win = gw.getActiveWindowTitle()
  207. if mentor_user.title() in active_win.title():
  208. # # mentor_win.activate()
  209. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/contabile.png', confidence=CONF)
  210. sleep(0.1)
  211. if butt_x_y:
  212. gui.click(butt_x_y[0], butt_x_y[1])
  213. pos_x_y = gui.position()
  214. gui.moveTo(pos_x_y[0], pos_x_y[1])
  215. gui.press('down', 6, sleep_)
  216. gui.press('return', 1, sleep_)
  217. mv_mouse_cent()
  218. @_printer
  219. def stocks():
  220. '''stocuri pe gestiuni'''
  221. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  222. active_win = gw.getActiveWindowTitle()
  223. if mentor_user.title() in active_win.title():
  224. # # mentor_win.activate()
  225. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/stocuri.png', confidence=CONF)
  226. sleep(0.1)
  227. if butt_x_y:
  228. gui.click(butt_x_y[0], butt_x_y[1])
  229. pos_x_y = gui.position()
  230. gui.moveTo(pos_x_y[0], pos_x_y[1])
  231. gui.press('down', 8, sleep_)
  232. gui.press('return', 1, sleep_)
  233. mv_mouse_cent()
  234. @_printer
  235. def product_details():
  236. '''fisa de magazie'''
  237. # _date_ = gui.getWindow('LISTE - ')
  238. # # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  239. active_win = gw.getActiveWindowTitle()
  240. if mentor_user.title() in active_win.title():
  241. # mentor_win.activate()
  242. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/stocuri.png', confidence=CONF)
  243. sleep(0.1)
  244. if butt_x_y:
  245. gui.click(butt_x_y[0], butt_x_y[1])
  246. pos_x_y = gui.position()
  247. gui.moveTo(pos_x_y[0], pos_x_y[1])
  248. gui.press('right', 1, sleep_)
  249. gui.press('return', 1, sleep_)
  250. mv_mouse_cent()
  251. @_printer
  252. def salary():
  253. '''stat de plata'''
  254. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  255. active_win = gw.getActiveWindowTitle()
  256. if mentor_user.title() in active_win.title():
  257. # mentor_win.activate()
  258. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/salarii.png', confidence=CONF)
  259. sleep(0.1)
  260. if butt_x_y:
  261. gui.click(butt_x_y[0], butt_x_y[1])
  262. pos_x_y = gui.position()
  263. gui.moveTo(pos_x_y[0], pos_x_y[1])
  264. gui.press('down', 1, sleep_)
  265. gui.press('right', 1, sleep_)
  266. gui.press('down', 3, sleep_)
  267. gui.press('return', 1, sleep_)
  268. mv_mouse_cent()
  269. # gui.move(1, 1)
  270. @_printer
  271. def sinteza():
  272. '''contr. sinteza'''
  273. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  274. active_win = gw.getActiveWindowTitle()
  275. if mentor_user.title() in active_win.title():
  276. # mentor_win.activate()
  277. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/salarii.png', confidence=CONF)
  278. sleep(0.1)
  279. if butt_x_y:
  280. gui.click(butt_x_y[0], butt_x_y[1])
  281. pos_x_y = gui.position()
  282. gui.moveTo(pos_x_y[0], pos_x_y[1])
  283. gui.press('down', 19, sleep_)
  284. gui.press('right', 1, sleep_)
  285. gui.press('return', 1, sleep_)
  286. mv_mouse_cent()
  287. # gui.move(1, 1)
  288. @_printer
  289. def h_key18():
  290. '''stocuri la terti'''
  291. try:
  292. sleep(sleep_)
  293. dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  294. active_win = gw.getActiveWindowTitle()
  295. if dummy.title in active_win:
  296. try:
  297. dummy.activate()
  298. except Exception as e:
  299. print(str(e))
  300. mv_mouse_right()
  301. kb.press_and_release('control+f10')
  302. gui.press('right', 1, sleep_)
  303. gui.press('down', 1, sleep_)
  304. gui.press('down', 12, sleep_)
  305. gui.press('return', 2, sleep_)
  306. except IndexError:
  307. print('please activate Window LISTE')
  308. @_printer
  309. def buy_journal():
  310. '''jurnal de cumparari'''
  311. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  312. active_win = gw.getActiveWindowTitle()
  313. if mentor_user.title() in active_win.title():
  314. # mentor_win.activate()
  315. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/trezorerie.png', confidence=CONF)
  316. sleep(0.1)
  317. if butt_x_y:
  318. gui.click(butt_x_y[0], butt_x_y[1])
  319. pos_x_y = gui.position()
  320. gui.moveTo(pos_x_y[0], pos_x_y[1])
  321. gui.press('down', 12, sleep_)
  322. gui.press('right', 1, sleep_)
  323. gui.press('down', 1, sleep_)
  324. gui.press('return', 1, sleep_)
  325. mv_mouse_cent()
  326. # print('please activate Window LISTE')
  327. @_printer
  328. def sell_journal():
  329. '''jurnal de vanzari'''
  330. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  331. active_win = gw.getActiveWindowTitle()
  332. if mentor_user.title() in active_win.title():
  333. # mentor_win.activate()
  334. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/trezorerie.png', confidence=CONF)
  335. sleep(0.1)
  336. if butt_x_y:
  337. gui.click(butt_x_y[0], butt_x_y[1])
  338. pos_x_y = gui.position()
  339. gui.moveTo(pos_x_y[0], pos_x_y[1])
  340. gui.press('down', 13, sleep_)
  341. gui.press('right', 1, sleep_)
  342. gui.press('down', 1, sleep_)
  343. gui.press('return', 1, sleep_)
  344. mv_mouse_cent()
  345. # print('please activate Window LISTE')
  346. @_printer
  347. def h_key19():
  348. '''pe cont 602.02'''
  349. try:
  350. sleep(sleep_)
  351. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  352. # active_win = gw.getActiveWindowTitle()
  353. # if dummy.title in active_win:
  354. # try:
  355. # dummy.activate()
  356. # except Exception as e:
  357. # print(str(e))
  358. mv_mouse_right()
  359. gui.press('return', 1, sleep_)
  360. gui.press('down', 4, sleep_)
  361. gui.press('return', 1, sleep_)
  362. gui.press('backspace', 1, sleep_)
  363. gui.typewrite('602.02', interval=sleep_)
  364. gui.press('return', 1, sleep_)
  365. except IndexError:
  366. print('please activate Window LISTE')
  367. @_printer
  368. def h_key20():
  369. '''pe cont 602.08'''
  370. try:
  371. sleep(sleep_)
  372. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  373. # active_win = gw.getActiveWindowTitle()
  374. # if dummy.title in active_win:
  375. # try:
  376. # dummy.activate()
  377. # except Exception as e:
  378. # print(str(e))
  379. mv_mouse_right()
  380. gui.press('return', 1, sleep_)
  381. gui.press('down', 4, sleep_)
  382. gui.press('return', 1, sleep_)
  383. gui.press('backspace', 1, sleep_)
  384. gui.typewrite('602.08', interval=sleep_)
  385. gui.press('return', 1, sleep_)
  386. except IndexError:
  387. print('please activate Window LISTE')
  388. @_printer
  389. def h_key21():
  390. '''pe cont 542'''
  391. try:
  392. sleep(sleep_)
  393. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  394. # active_win = gw.getActiveWindowTitle()
  395. # if dummy.title in active_win:
  396. # try:
  397. # dummy.activate()
  398. # except Exception as e:
  399. # print(str(e))
  400. mv_mouse_right()
  401. gui.press('return', 1, sleep_)
  402. gui.press('down', 4, sleep_)
  403. gui.press('return', 1, sleep_)
  404. gui.press('backspace', 1, sleep_)
  405. gui.typewrite('542', interval=sleep_)
  406. gui.press('return', 1, sleep_)
  407. except IndexError:
  408. print('please activate Window LISTE')
  409. @_printer
  410. def h_key22():
  411. '''pe cont 627'''
  412. try:
  413. sleep(sleep_)
  414. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  415. # active_win = gw.getActiveWindowTitle()
  416. # if dummy.title in active_win:
  417. # try:
  418. # dummy.activate()
  419. # except Exception as e:
  420. # print(str(e))
  421. mv_mouse_right()
  422. gui.press('return', 1, sleep_)
  423. # gui.press('tab', 2, sleep_)
  424. gui.press('down', 4, sleep_)
  425. gui.press('return', 1, sleep_)
  426. gui.press('backspace', 1, sleep_)
  427. gui.typewrite('627', interval=sleep_)
  428. gui.press('return', 1, sleep_)
  429. except IndexError:
  430. print('please activate Window LISTE')
  431. @_printer
  432. def h_key23():
  433. '''pe cont 604'''
  434. try:
  435. sleep(sleep_)
  436. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  437. # active_win = gw.getActiveWindowTitle()
  438. # if dummy.title in active_win:
  439. # try:
  440. # dummy.activate()
  441. # except Exception as e:
  442. # print(str(e))
  443. mv_mouse_right()
  444. gui.press('return', 1, sleep_)
  445. gui.press('down', 4, sleep_)
  446. gui.press('return', 1, sleep_)
  447. gui.press('backspace', 1, sleep_)
  448. gui.typewrite('604', interval=sleep_)
  449. gui.press('return', 1, sleep_)
  450. except IndexError:
  451. print('please activate Window LISTE')
  452. @_printer
  453. def h_key24():
  454. '''pe cont 628'''
  455. try:
  456. sleep(sleep_)
  457. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  458. # active_win = gw.getActiveWindowTitle()
  459. # if dummy.title in active_win:
  460. # try:
  461. # dummy.activate()
  462. # except Exception as e:
  463. # print(str(e))
  464. mv_mouse_right()
  465. gui.press('return', 1, sleep_)
  466. gui.press('down', 4, sleep_)
  467. gui.press('return', 1, sleep_)
  468. gui.press('backspace', 1, sleep_)
  469. gui.typewrite('628', interval=sleep_)
  470. gui.press('return', 1, sleep_)
  471. except IndexError:
  472. print('please activate Window LISTE')
  473. @_printer
  474. def partner_balance():
  475. '''fisa partener'''
  476. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  477. active_win = gw.getActiveWindowTitle()
  478. if mentor_user.title() in active_win.title():
  479. # mentor_win.activate()
  480. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/parteneri.png', confidence=CONF)
  481. sleep(0.1)
  482. if butt_x_y:
  483. gui.click(butt_x_y[0], butt_x_y[1])
  484. pos_x_y = gui.position()
  485. gui.moveTo(pos_x_y[0], pos_x_y[1])
  486. gui.press('down', 1, sleep_)
  487. gui.press('down', 7, sleep_)
  488. gui.press('return', 2, sleep_)
  489. mv_mouse_cent()
  490. @_printer
  491. def partner_balance2():
  492. '''balanta partener'''
  493. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  494. active_win = gw.getActiveWindowTitle()
  495. if mentor_user.title() in active_win.title():
  496. # mentor_win.activate()
  497. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/parteneri.png', confidence=CONF)
  498. sleep(0.1)
  499. if butt_x_y:
  500. gui.click(butt_x_y[0], butt_x_y[1])
  501. pos_x_y = gui.position()
  502. gui.moveTo(pos_x_y[0], pos_x_y[1])
  503. gui.press('down', 9, sleep_)
  504. gui.press('return', 1, sleep_)
  505. gui.press('down', 1, sleep_)
  506. gui.press('return', 1, sleep_)
  507. mv_mouse_cent()
  508. @_printer
  509. def assets():
  510. '''registru imobilizari'''
  511. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  512. active_win = gw.getActiveWindowTitle()
  513. if mentor_user.title() in active_win.title():
  514. # mentor_win.activate()
  515. butt_x_y = gui.locateCenterOnScreen(f'mentor_imgs/miscari.png', confidence=CONF)
  516. sleep(0.1)
  517. if butt_x_y:
  518. gui.click(butt_x_y[0], butt_x_y[1])
  519. pos_x_y = gui.position()
  520. gui.moveTo(pos_x_y[0], pos_x_y[1])
  521. gui.press('down', 14, sleep_)
  522. gui.press('return', 1, sleep_)
  523. gui.press('down', 5, sleep_)
  524. # gui.press('return', 1, sleep_)
  525. mv_mouse_cent()
  526. @_printer
  527. def h_key26():
  528. '''service structuri'''
  529. try:
  530. sleep(sleep_)
  531. declaratii = gw.getWindowsWithTitle('DECLARATII')[0]
  532. if declaratii.title in gw.getActiveWindowTitle():
  533. mv_mouse_right()
  534. kb.press_and_release('control+f10')
  535. gui.press('down', 1, sleep_)
  536. gui.press('return', 1, sleep_)
  537. except IndexError:
  538. print('please activate Window LISTE')
  539. @_printer
  540. def h_key27():
  541. '''vector d100'''
  542. try:
  543. sleep(sleep_)
  544. declaratii = gw.getWindowsWithTitle('DECLARATII')[0]
  545. if declaratii.title in gw.getActiveWindowTitle():
  546. mv_mouse_right()
  547. kb.press_and_release('control+f10')
  548. gui.press('right', 1, sleep_)
  549. gui.press('down', 1, sleep_)
  550. gui.press('return', 1, sleep_)
  551. except IndexError:
  552. print('please activate Window LISTE')
  553. @_printer
  554. def h_key28():
  555. '''pe cont 623'''
  556. try:
  557. sleep(sleep_)
  558. # dummy = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  559. # active_win = gw.getActiveWindowTitle()
  560. # if dummy.title in active_win:
  561. # try:
  562. # dummy.activate()
  563. # except Exception as e:
  564. # print(str(e))
  565. mv_mouse_right()
  566. gui.press('return', 1, sleep_)
  567. gui.press('down', 4, sleep_)
  568. gui.press('return', 1, sleep_)
  569. gui.press('backspace', 1, sleep_)
  570. gui.typewrite('623', interval=sleep_)
  571. gui.press('return', 1, sleep_)
  572. except IndexError:
  573. print('please activate Window LISTE')
  574. def open_decl():
  575. try:
  576. chrome_win = gw.getWindowsWithTitle('https://decl.anaf.mfinante.gov.ro/WAS6DUS/ - Google Chrome')[0]
  577. active_win = gw.getActiveWindowTitle()
  578. if chrome_win.title in active_win:
  579. chrome_win.activate()
  580. butt_x_y = gui.locateCenterOnScreen('ciel_imgs/decl_choose_file.png', confidence=CONF)
  581. sleep(0.1)
  582. # pos_x_y = gui.position()
  583. if butt_x_y:
  584. gui.click(butt_x_y[0], butt_x_y[1])
  585. mv_mouse_cent()
  586. # gui.moveTo(pos_x_y[0], pos_x_y[1])
  587. except IndexError:
  588. pass
  589. def send_decl():
  590. try:
  591. chrome_win = gw.getWindowsWithTitle('https://decl.anaf.mfinante.gov.ro/WAS6DUS/ - Google Chrome')[0]
  592. active_win = gw.getActiveWindowTitle()
  593. if chrome_win.title in active_win:
  594. chrome_win.activate()
  595. butt_x_y = gui.locateCenterOnScreen('ciel_imgs/decl_send.png', confidence=CONF)
  596. sleep(0.1)
  597. # pos_x_y = gui.position()
  598. if butt_x_y:
  599. gui.click(butt_x_y[0], butt_x_y[1])
  600. mv_mouse_cent()
  601. # gui.moveTo(pos_x_y[0], pos_x_y[1])
  602. except IndexError:
  603. pass
  604. @_printer
  605. def mod_salary():
  606. '''mudul salarii'''
  607. # mentor_win = gw.getWindowsWithTitle(mentor_user, condition=gw.Re.CONTAINS)[0]
  608. active_win = gw.getActiveWindowTitle()
  609. if mentor_user.title() in active_win.title():
  610. # mentor_win.activate()
  611. butt_x_y_1 = gui.locateCenterOnScreen(f'mentor_imgs/modul_salarii.png', confidence=CONF)
  612. butt_x_y_2 = gui.locateCenterOnScreen(f'mentor_imgs/modul_mentor.png', confidence=CONF)
  613. sleep(0.01)
  614. if butt_x_y_1:
  615. gui.click(butt_x_y_1[0], butt_x_y_1[1])
  616. pos_x_y = gui.position()
  617. gui.moveTo(pos_x_y[0], pos_x_y[1])
  618. elif butt_x_y_2:
  619. gui.click(butt_x_y_2[0], butt_x_y_2[1])
  620. pos_x_y = gui.position()
  621. gui.moveTo(pos_x_y[0], pos_x_y[1])
  622. mv_mouse_cent()
  623. def ment():
  624. gui.press('backspace', 3)
  625. gui.typewrite('RM1984ent')
  626. # kb.register_hotkey('alt+`', h_key2())
  627. def main():
  628. '''quick_hotkey_ab'''
  629. kb.register_hotkey('`+r+j', remake_journal, args=()) # refacere jurnal
  630. kb.register_hotkey('`+r+c', cash_registry, args=()) # casa
  631. kb.register_hotkey('`+c+z', clients_ron, args=()) # clienti
  632. kb.register_hotkey('`+b+v', verif_balance, args=()) # balanta
  633. kb.register_hotkey('`+r+f', suppliers_ron, args=()) # ron furnizori
  634. kb.register_hotkey('`+d+x', suppliers_val, args=()) # deviza furnizori
  635. # kb.register_hotkey('`+d+c', h_key11, args=()) # clienti valuta
  636. kb.register_hotkey('`+r+b', bank_registry_ron, args=()) # ron banca
  637. kb.register_hotkey('`+v+j', bank_registry_val, args=()) # valuta banca
  638. kb.register_hotkey('`+p', h_key14, args=()) # digi
  639. # kb.register_hotkey('`+m+p', h_key15, args=()) # mentor
  640. # kb.add_hotkey('`+m+p', abbr, args=('`+m+p', r'RM1984ent', '`'))
  641. kb.add_abbreviation('mnt', 'RM1984ent')
  642. kb.add_abbreviation('vau', 'abc0nsu1t1ng')
  643. # kb.add_word_listener('mnt', lambda: ment(), triggers=['t'])
  644. kb.register_hotkey('`+f+x', account_details, args=()) # fisa cont
  645. kb.register_hotkey('`+s+g', stocks, args=()) # stoc gestiuni
  646. kb.register_hotkey('`+s+m', product_details, args=()) # stoc fisa magazie
  647. kb.register_hotkey('`+s+t', h_key18, args=()) # stocuri la terti
  648. kb.register_hotkey('`+f+t', partner_balance, args=()) # fisa terti
  649. kb.register_hotkey('`+b+p', partner_balance2, args=()) # fisa terti
  650. kb.register_hotkey('`+s+p', salary, args=()) # stat de plata
  651. kb.register_hotkey('`+c+s', sinteza, args=()) # contributii sinteza
  652. kb.register_hotkey('control+alt+o', fill_394, args=())
  653. kb.register_hotkey('shift+f11', sign_bil, args=())
  654. kb.register_hotkey('control+q', close_all_lists, args=()) # close all lists
  655. kb.register_hotkey('`+t+x', buy_journal, args=()) # jurnal de cumparari
  656. kb.register_hotkey('`+t+v', sell_journal, args=()) # jurnal de vanzari
  657. # kb.register_hotkey('control+`', open_decl, args=()) # deschide declaratie
  658. # kb.register_hotkey('shift+`', send_decl, args=()) # trimite declaratii
  659. # kb.register_hotkey('`+m+n', sp.run, args=(['C:/Users/vnc-console/WinMent/MENTOR.exe']))
  660. kb.register_hotkey('`+9', mod_salary, args=()) # modul salarii
  661. kb.register_hotkey('`+b+p', partner_balance2, args=()) # balanta parteneri
  662. kb.register_hotkey('`+m+u', assets, args=()) # imobilizari
  663. # kb.register_hotkey('alt+3', h_key28, args=()) # 623, 766
  664. # kb.register_hotkey('alt+4', h_key22, args=()) # 627
  665. # kb.register_hotkey('alt+5', h_key21, args=()) # 542
  666. # kb.register_hotkey('alt+6', h_key23, args=()) # 604, 508.01
  667. # kb.register_hotkey('alt+7', h_key24, args=()) # 628
  668. # kb.register_hotkey('alt+8', h_key19, args=()) # 602.02
  669. # kb.register_hotkey('alt+9', h_key20, args=()) # 602.08
  670. # kb.register_hotkey('alt+win+c', lambda: sp.run('C:/Users/vnc-console/Winment_declaratii/DeclaratiiR.exe', shell=True))
  671. # kb.wait()
  672. if __name__ == '__main__':
  673. main()
  674. # ment_app = gw.getWindowsWithTitle('MENTOR', condition=gw.Re.CONTAINS)[0]
  675. # ment_app.activate()
  676. # sleep(5)
  677. # print(gw.getActiveWindowTitle())
  678. # print('anyad')