Advertisement
NeoAeon

Chups

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