Advertisement
NeoAeon

CHUPS 2

Jan 11th, 2024 (edited)
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 8.76 KB | Source Code | 0 0
  1. #Persistent
  2. #NoEnv
  3. #HotKeyInterval 1
  4. #MaxHotkeysPerInterval 127
  5. #InstallKeybdHook
  6. #UseHook
  7. #SingleInstance, Force
  8.  
  9. SetControlDelay, -1
  10. SetMouseDelay, -1
  11. SetWinDelay,-1
  12. SetBatchLines,-1
  13.  
  14. IniRead, EditUF, %A_ScriptName%, Settings, iniUF
  15.  
  16. Gui, ProgramGui: Font, s10 bolda Verdana cYellow
  17. Gui, ProgramGui: Color, Black
  18. Gui, ProgramGui: add, text, cYellow , Insira o UF da base
  19. Gui, ProgramGui: add, edit, w27 h21 cBlack vUF, %EditUF%
  20. Gui, ProgramGui: add, button, x125 y35 w20 h20 gFechar, X
  21. Gui, ProgramGui: show,, Roterizador
  22. Return
  23.  
  24. Fechar:
  25. ExitApp
  26. Return
  27.  
  28. !z::
  29. Gui, ProgramGui: Submit, NoHide
  30. {
  31. GoSub, MouseOff
  32. }
  33. return
  34.  
  35. *F4::
  36. CicloPm := 0
  37. Return
  38.  
  39. *F3::
  40. CicloPm := 1
  41. Return
  42.  
  43. *F5::
  44. Gosub, Rel
  45. Return
  46.  
  47. *F6::
  48. Pause
  49. Return
  50.  
  51. MouseOff:
  52.  Loop
  53.   {
  54.   Gui, ProgramGui: Submit, NoHide
  55.   NomeMotorista := "`r`n"
  56.   Destino := "`r`n"
  57.   LinkStrava := "`r`n"
  58.   ValKm := "`r`n"
  59.   LinkPed := "`r`n"
  60.   KmMaps := "`r`n"
  61.   MapsLink := "`r`n"
  62.   NotValid := 0
  63.   Nfs := 0
  64.   OBS := 0
  65.   EvDivergente := 0
  66.   Primary := 0
  67.   sleep, 70
  68.   send, ^{c}
  69.   sleep, 100
  70.   NomeMotorista := ClipBoard
  71.   sleep, 50
  72.   if (NomeMotorista = "`r`n")
  73.   {
  74.   break
  75.   }
  76.   sleep, 50
  77.   send, {Right}
  78.   sleep, 100
  79.   send, ^{c}
  80.   sleep, 100
  81.   Destino := ClipBoard
  82.   sleep, 100
  83.   ClipBoard := "`r`n"
  84.   sleep, 100
  85.   send, {right}
  86.   sleep, 100
  87.   send, ^{c}
  88.   sleep, 100
  89.   if (Clipboard = "`r`n")
  90.   {
  91.   OBS := 0
  92.   }
  93.   else if (ClipBoard !="`r`n")
  94.   {
  95.   OBS := ClipBoard
  96.   }
  97. Sleep, 50
  98. ClipBoard := "`r`n"
  99. sleep, 100
  100. send, {right}
  101. sleep, 100
  102. send, ^{c}
  103. clipwait
  104. sleep, 100
  105. if (ClipBoard = "`r`n")
  106. {
  107. Nfs := 1
  108. }
  109. else if (Clipboard != "`r`n")
  110. {
  111. Nfs := 0
  112. sleep, 20
  113. LinkStrava := ClipBoard
  114. sleep, 100
  115. ClipBoard := "`r`n"
  116. sleep, 100
  117. send, {right}
  118. sleep, 100
  119. send, ^{c}
  120. clipwait
  121. sleep, 100
  122. ValKm := ClipBoard
  123. sleep, 100
  124. if (ValKm = "`r`n")
  125. {
  126. EvDivergente := 1
  127. }
  128. }
  129. ClipBoard := "`r`n"
  130. sleep, 50
  131. WinActivate, ahk_exe DDSLogistica.exe
  132. WinWaitActive, ahk_exe DDSLogistica.exe
  133. sleep, 200
  134. WinGetTitle, Title, A
  135. loop
  136. {
  137.   CoordMode, Pixel, Relative
  138.   PixelSearch, X, Y, 1039, 224, 1110, 240, 0x6782B6, 20, Fast RGB
  139.   if errorlevel = 0
  140.   break
  141. }
  142.   ControlClick, x1096 y259, %Title%,, Left, 1, NA
  143.   sleep, 100
  144.   Loop, Parse, % StrSplit(NomeMotorista,"/").1
  145. {
  146.   Send, % A_LoopField
  147.   Sleep, 100
  148. }
  149. send, {esc}
  150. sleep, 250
  151. ControlClick, x1520 y406, %Title%,, Left, 1, NA
  152. sleep, 250
  153. ControlClick, x344 y521, %Title%,, Left, 1, NA
  154. loop
  155. {
  156.   CoordMode, Pixel, Relative
  157.   PixelSearch, X, Y, 357, 208, 388, 239, 0xD23D26, 20, Fast RGB
  158.   if errorlevel = 0
  159.   break
  160. }
  161. sleep, 500
  162. ControlClick, x1180 y739, %Title%,, Left, 1, NA
  163. sleep, 800
  164. Loop, Parse, UF, `/
  165. {
  166.   Send, % A_LoopField
  167.   Sleep, 250
  168. }
  169. sleep, 200
  170. send, {esc}
  171. sleep, 100
  172. Loop, Parse, Destino, `/
  173. if (A_LoopField !="`r`n")
  174. {
  175.   sleep, 100
  176.   ControlClick, x1379 y746, %Title%,, Left, 2, NA
  177.   sleep, 1000
  178.   Send, % A_LoopField
  179.   sleep, 1000
  180.   send, {esc}
  181.   sleep, 150
  182.   ControlClick, x1639 y740, %Title%,, Left, 1, NA
  183.   sleep, 800
  184. }
  185. send, {esc}
  186. sleep, 400
  187. if (Nfs = 0)
  188. {
  189. if (EvDivergente = 1)
  190. {
  191. ControlClick, x1630 y913, %Title%,, Left, 2, NA
  192. sleep, 50
  193. ClipBoard := "`r`n"
  194. sleep, 20
  195. send, ^{a}
  196. sleep, 50
  197. send, ^{c}
  198. ClipWait
  199. sleep, 50
  200. if (clipboard = 0) or (clipboard = "`r`n")
  201. {
  202. msgbox, destino incorreto ou tem que roteirizar, lembra de olhar outras minutas com o mesmo destino
  203. pause
  204. ControlClick, x1630 y913, %Title%,, Left, 2, NA
  205. sleep, 100
  206. send, ^{a}
  207. sleep, 100
  208. send, ^{c}
  209. ClipWait
  210. continue
  211. }
  212. sleep, 50
  213. KmDiv := StrSplit(ClipBoard,",").1
  214. sleep, 150
  215. ValKm := KmDiv
  216. }
  217. ControlClick, x492 y945, %Title%,, Left, 2, NA
  218. sleep, 200
  219. send, ^{a}
  220. sleep, 50
  221. send, %LinkStrava%
  222. sleep, 200
  223. ControlClick, x1166 y590, %Title%,, Left, 2, NA
  224. sleep, 100
  225. send, ^{a}
  226. sleep, 50
  227. send, %ValKm%
  228. sleep, 100
  229. ControlClick, x920 y520, %Title%,, Left, 2, NA
  230. sleep, 150
  231. ControlClick, x1598 y520, %Title%,, Left, 2, NA
  232. sleep, 500
  233. GoSub, VerificarFaixaValKm
  234. sleep, 50
  235. Gosub, VerificarFaixaKmMaps
  236. sleep, 50
  237. Gosub, ComparativoFaixas
  238. sleep, 180
  239. if (NotValid = 1)
  240. {
  241. ControlClick, x824 y821, %Title%,, Left, 1, NA
  242. sleep, 80
  243. send, -Strava desconsiderado pois nao atinge o km
  244. sleep, 50
  245. send, {space}
  246. sleep, 50
  247. send, %LinkStrava%
  248. sleep, 80
  249. ControlClick, x469 y948, %Title%,, Left, 2, NA
  250. sleep, 80
  251. send, ^{a}
  252. sleep, 50
  253. send, {del}
  254. sleep, 80
  255. ControlClick, x1166 y569, %Title%,, Left, 2, NA
  256. sleep, 80
  257. send, ^{a}
  258. sleep, 50
  259. send, {del}
  260. }
  261. }
  262. if (Nfs = 1)
  263. {
  264. sleep, 50
  265. ControlClick, x1630 y913, %Title%,, Left, 2, NA
  266. sleep, 50
  267. ClipBoard := "`r`n"
  268. sleep, 50
  269. send, ^{a}
  270. sleep, 50
  271. send, ^{c}
  272. ClipWait
  273. sleep, 50
  274. KmMaps := ClipBoard
  275. Sleep, 50
  276. ClipBoard := "`r`n"
  277. sleep, 80
  278. ControlClick, x1300 y951, %Title%,, Left, 2, NA
  279. sleep, 100
  280. send, ^{a}
  281. sleep, 50
  282. send, ^{c}
  283. clipwait
  284. MapsLink := ClipBoard
  285. sleep, 50
  286. ClipBoard= "`r`n"
  287. sleep, 800
  288. ControlClick, x1180 y739, %Title%,, Left, 1, NA
  289. sleep, 500
  290. Loop, Parse, UF, `/
  291. {
  292.   Send, % A_LoopField
  293.   Sleep, 250
  294. }
  295. sleep, 200
  296. send, {esc}
  297. sleep, 100
  298. DestinoNfs := "Não Fez Strava"
  299. Loop, Parse, DestinoNfs, `/
  300. if (A_LoopField !="`r`n")
  301. {
  302.   ControlClick, x1379 y746, %Title%,, Left, 2, NA
  303.   sleep, 1000
  304.   Send, % A_LoopField
  305.   sleep, 1000
  306.   send, {esc}
  307.   sleep, 150
  308.   ControlClick, x1630 y740, %Title%,, Left, 1, NA
  309.   sleep, 800
  310. }
  311. send, {esc}
  312. sleep, 50
  313. ControlClick, x1300 y951, %Title%,, Left, 2, NA
  314. sleep, 50
  315. send, ^{a}
  316. sleep, 50
  317. send, %MapsLink%
  318. sleep, 50
  319. ControlClick, x1621 y914, %Title%,, Left, 2, NA
  320. sleep, 50
  321. send, ^{a}
  322. sleep, 50
  323. send, 1
  324. sleep, 100
  325. send, {tab}
  326. sleep, 100
  327. ControlClick, x1160 y590, %Title%,, Left, 2, NA
  328. sleep, 80
  329. send, ^{a}
  330. sleep, 50
  331. send, %KmMaps%
  332. sleep, 100
  333. ControlClick, x920 y520, %Title%,, Left, 2, NA
  334. sleep, 150
  335. ControlClick, x1598 y520, %Title%,, Left, 2, NA
  336. }
  337. WinActivate, ahk_exe DDSLogistica.exe
  338. WinWaitActive, ahk_exe DDSLogistica.exe
  339. sleep, 350
  340. if CicloPm = 1
  341. {
  342. ControlClick, x1593 y355, %Title%,, Left, 2, NA
  343. sleep, 150
  344. ControlClick, x920 y520, %Title%,, Left, 2, NA
  345. sleep, 150
  346. ControlClick, x1598 y520, %Title%,, Left, 2, NA
  347. }
  348. If (OBS != 0)
  349. {
  350. ControlClick, x824 y821, %Title%,, Left, 1, NA
  351. sleep, 80
  352. send, {space}
  353. send, - %OBS%
  354. }
  355. sleep, 1000
  356. ControlClick, x347 y224, %Title%,, Left, 1, NA
  357. sleep, 1000
  358. Loop
  359. {
  360. IfWinExist, ahk_class #32770
  361. {
  362. Send, {space}
  363. sleep, 500
  364. break
  365. }
  366. }
  367. Loop
  368. {
  369. IfWinExist, ahk_class #32770
  370. {
  371. Send, {space}
  372. sleep, 500
  373. break
  374. }
  375. }
  376. sleep, 350
  377. Send, {Enter}
  378. sleep, 650
  379. ControlClick, x511 y191, %Title%,, Left, 2, NA
  380. sleep, 500
  381. WinActivate, ahk_exe EXCEL.EXE
  382. sleep, 50
  383. WinActivate, ahk_exe EXCEL.EXE
  384. sleep, 100
  385. send, {Left}
  386. sleep, 50
  387. send, {Left}
  388. sleep, 50
  389. send, {Left}
  390. sleep, 50
  391. send, {Left}
  392. sleep, 50
  393. send, {Left}
  394. sleep, 50
  395. send, {Left}
  396. sleep, 50
  397. send, {Down}
  398. ClipBoard := "`r`n"
  399. }
  400. Return
  401.  
  402. VerificarFaixaValKm:
  403. ValKm := StrSplit(ValKm,",").1
  404. sleep, 150
  405. if (Valkm > 399)
  406. {
  407. MsgBox, 4,, Certeza que o cara rodou mais de 400km?
  408. IfMsgBox Yes
  409.     ValkmFaixa = 8
  410. else
  411.     Pause
  412. }
  413. else if (ValKm >= 351)
  414. {
  415. ValkmFaixa = 7
  416. }
  417. else if (ValKm >= 301)
  418. {
  419. ValkmFaixa = 6
  420. }
  421. else if (ValKm >= 251)
  422. {
  423. ValkmFaixa = 5
  424. }
  425. else if (ValKm >= 201)
  426. {
  427. ValkmFaixa = 4
  428. }
  429. else if (ValKm >= 151)
  430. {
  431. ValkmFaixa = 3
  432. }
  433. else if (ValKm >= 101)
  434. {
  435. ValkmFaixa = 2
  436. }
  437. else if (ValKm <= 100)
  438. {
  439. ValkmFaixa = 1
  440. }
  441. return
  442.  
  443.  
  444. VerificarFaixaKmMaps:
  445. loop
  446. {
  447. sleep, 400
  448. ControlClick, x1630 y919, %Title%,, Left, 2, NA
  449. sleep, 50
  450. send, ^{a}
  451. sleep, 50
  452. send, ^{c}
  453. ClipWait
  454. sleep, 150
  455. KmMaps := StrSplit(ClipBoard,",").1
  456. sleep, 150
  457. if (KmMaps = 0) or (KmMaps = "`r`n")
  458. {
  459. msgbox, destino incorreto ou tem que roteirizar, lembra de olhar outras minutas com o mesmo destino
  460. pause
  461. ControlClick, x1630 y913, %Title%,, Left, 2, NA
  462. sleep, 50
  463. send, ^{a}
  464. sleep, 50
  465. send, ^{c}
  466. ClipWait
  467. sleep, 50
  468. KmMaps := StrSplit(ClipBoard,",").1
  469. ControlClick, x920 y500, %Title%,, Left, 2, NA
  470. sleep, 150
  471. ControlClick, x1598 y500, %Title%,, Left, 2, NA
  472. continue
  473. }
  474. else if (KmMaps >= 400)
  475. {
  476. KmMapsFaixa = 8
  477. break
  478. }
  479. else if (KmMaps >= 351)
  480. {
  481. KmMapsFaixa = 7
  482. break
  483. }
  484. else if (KmMaps >= 301)
  485. {
  486. KmMapsFaixa = 6
  487. break
  488. }
  489. else if (KmMaps >= 251)
  490. {
  491. KmMapsFaixa = 5
  492. break
  493. }
  494. else if (KmMaps >= 201)
  495. {
  496. KmMapsFaixa = 4
  497. break
  498. }
  499. else if (KmMaps >= 151)
  500. {
  501. KmMapsFaixa = 3
  502. break
  503. }
  504. else if (KmMaps >= 101)
  505. {
  506. KmMapsFaixa = 2
  507. break
  508. }
  509. else if (KmMaps <= 100)
  510. {
  511. KmMapsFaixa = 1
  512. break
  513. }
  514. }
  515. return
  516.  
  517.  
  518. ComparativoFaixas:
  519. If (ValkmFaixa < KmMapsFaixa)
  520. {
  521. Nfs := 1
  522. NotValid := 1
  523. }
  524. else if (ValkmFaixa > KmMapsFaixa)
  525. {
  526. MsgBox, 4,, Faixa de km otus maior, tem certeza?
  527. IfMsgBox No
  528.     Pause
  529. ControlClick, x920 y520, %Title%,, Left, 2, NA
  530. sleep, 150
  531. ControlClick, x1598 y520, %Title%,, Left, 2, NA
  532. }
  533. Return
  534.  
  535. Rel:
  536. GuiControlGet, CtrlContents,, vUF
  537. IniWrite, %UF%, %A_ScriptName%, Settings, iniUF
  538. Reload
  539. Return
  540.  
  541. /*
  542. [Settings]
  543. iniUF=mg
  544. */
  545.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement