Advertisement
NeoAeon

Logistics Modelo

Jan 27th, 2024 (edited)
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 7.72 KB | Source Code | 0 0
  1. #SingleInstance force
  2.  
  3. Path := "C:\Users\paulo\OneDrive\Documents\Robo\CADASTROS LOGÍSTICS.xlsx"
  4. XL := ComObjCreate("Excel.Application")
  5. XL.Visible := true
  6. XL_Workbook := XL.Workbooks.Open(Path)
  7. XL_WorkSheet := XL_Workbook.Worksheets(1) ; Numero da sheet
  8.  
  9. *F1::
  10. loop
  11. {
  12. WinGetTitle, Title, A
  13. XL.ActiveCell.Copy
  14. ClipWait
  15. sleep, 150
  16. if (Clipboard = "`r`n")
  17. {
  18. sleep, 50
  19. XL.Visible := true
  20. DllCall("user32.dll\LockWorkStation")
  21. Return
  22. }
  23. ControlClick, x357 y348, %Title%,, Left, 2, NA
  24. sleep, 50
  25. send, ^{a}
  26. sleep, 50
  27. send, ^{v}
  28. sleep, 50
  29. send, {enter}
  30. sleep, 20
  31. Loop
  32. {
  33.   CoordMode, Pixel, Relative
  34.   PixelSearch, X, Y, 1598, 102, 1851, 840, 0x3483FA , 5, Fast RGB
  35.   if errorlevel = 1
  36.   break
  37. }
  38. Loop
  39. {
  40.   CoordMode, Pixel, Relative
  41.   PixelSearch, X, Y, 1598, 102, 1851, 840, 0x3483FA, 5, Fast RGB
  42.   if errorlevel = 0
  43.   break
  44. }
  45. sleep, 50
  46.   CoordMode, Pixel, Relative
  47.   PixelSearch, X, Y, 213, 529, 277, 584, 0x3A3A3A, 5, Fast RGB
  48.   if (errorlevel = 0)
  49. {
  50. sleep, 350
  51. ControlClick, x1817 y557, %Title%,, Left, 1, NA
  52. sleep, 150
  53. send, {LCTRL down}
  54. sleep, 50
  55. ControlClick, x1648 y658, %Title%,, Left, 1, NA
  56. sleep, 350
  57. send, {2}
  58. send, {LCTRL Up}
  59. sleep, 1000
  60. loop
  61. {
  62.   CoordMode, Pixel, Relative
  63.   PixelSearch, X, Y, 1345, 1027, 1452, 1063, 0x3483FA, 5, Fast RGB
  64.   if errorlevel = 1
  65.   break
  66. }
  67. WinGetTitle, Title, A
  68. send, {WheelDown}
  69. sleep, 50
  70. send, {WheelDown}
  71. sleep, 800
  72. ControlClick, x954 y956, %Title%,, Left, 3, NA
  73. sleep, 200
  74. send ^{c}
  75. ClipWait
  76. sleep, 50
  77. CadastroDOC := Clipboard
  78. sleep, 150
  79. if (CadastroDOC != "Modelo")
  80. {
  81. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= CadastroDOC
  82. ControlClick, x584 y956, %Title%,, Left, 3, NA
  83. sleep, 200
  84. send ^{c}
  85. ClipWait
  86. sleep, 50
  87. Fabricante := Clipboard
  88. sleep, 250
  89. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Fabricante
  90. ControlClick, x1294 y956, %Title%,, Left, 3, NA
  91. sleep, 200
  92. send ^{c}
  93. ClipWait
  94. sleep, 50
  95. Ano := Clipboard
  96. sleep, 250
  97. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Ano
  98. ControlClick, x1260 y1065, %Title%,, Left, 3, NA
  99. sleep, 200
  100. send ^{c}
  101. ClipWait
  102. sleep, 50
  103. Eixos := Clipboard
  104. sleep, 250
  105. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Eixos
  106. ControlClick, x599 y810, %Title%,, Left, 3, NA
  107. sleep, 200
  108. send ^{c}
  109. ClipWait
  110. sleep, 50
  111. Renavam := Clipboard
  112. sleep, 250
  113. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Renavam
  114. ControlClick, x1073 y816, %Title%,, Left, 3, NA
  115. sleep, 200
  116. send ^{c}
  117. ClipWait
  118. sleep, 50
  119. Cidade := Clipboard
  120. sleep, 250
  121. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Cidade
  122. ControlClick, x1078 y693, %Title%,, Left, 3, NA
  123. sleep, 200
  124. send ^{c}
  125. ClipWait
  126. sleep, 50
  127. Chassi := Clipboard
  128. sleep, 250
  129. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Chassi
  130. sleep, 30
  131. Send, ^{w}
  132. XL.ActiveCell.Offset(1, -7).Select
  133. XL.ActiveCell.Interior.Color := 0x97DBED
  134. sleep, 200
  135. CadastroDOC := "`r`n"
  136. Fabricante := "`r`n"
  137. Ano := "`r`n"
  138. Eixos := "`r`n"
  139. Renavam := "`r`n"
  140. Cidade := "`r`n"
  141. Chassi := "`r`n"
  142. sleep, 200
  143. }
  144. else if (CadastroDOCs = "Modelo")
  145. {
  146. XL.ActiveCell.Offset(1, 0).Select
  147. }
  148. }
  149. else if (errorlevel = 1)
  150. {
  151. XL.ActiveCell.Offset(1, 0).Select
  152. }
  153. }
  154. Return
  155.  
  156. *!z::
  157. WinGetTitle, Title, A
  158. loop
  159. {
  160. XL.ActiveCell.Copy
  161. ClipWait
  162. sleep, 150
  163. if (Clipboard = "`r`n")
  164. {
  165. sleep, 50
  166. XL.Visible := true
  167. DllCall("user32.dll\LockWorkStation")
  168. Return
  169. }
  170. ControlClick, x340 y346, %Title%,, Left, 2, NA
  171. sleep, 50
  172. send, ^{a}
  173. sleep, 50
  174. send, ^{v}
  175. sleep, 50
  176. send, {enter}
  177. sleep, 50
  178. Clipboard := "`r`n"
  179. sleep, 20
  180. Loop
  181. {
  182.   CoordMode, Pixel, Relative
  183.   PixelSearch, X, Y, 1598, 102, 1851, 840, 0x3483FA , 5, Fast RGB
  184.   if errorlevel = 1
  185.   break
  186. }
  187. Loop
  188. {
  189.   CoordMode, Pixel, Relative
  190.   PixelSearch, X, Y, 1598, 102, 1851, 840, 0x3483FA , 5, Fast RGB
  191.   if errorlevel = 0
  192.   break
  193. }
  194. sleep, 600
  195. ControlClick, x331 y574, %Title%,, Left, 3, NA
  196. sleep, 400
  197. send, ^{c}
  198. ClipWait
  199. sleep, 250
  200. XL.ActiveCell.Interior.Color := 0x97DBED
  201. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= TipoRodado
  202. sleep, 100
  203. XL.ActiveCell.Offset(1, -1).Select
  204. sleep, 200
  205. TipoRodado := "`r`n"
  206. }
  207. return
  208.  
  209. *F4::
  210. Gosub, AbrirLista
  211. loop
  212. {
  213. AchouMotora := 0
  214. XL.ActiveCell.Copy
  215. ClipWait
  216. if (Clipboard = "`r`n")
  217. Break
  218. NomeMotora := ClipBoard
  219. sleep, 80
  220. WinActivate, ahk_exe msedge.exe
  221. WinWaitActive, ahk_exe msedge.exe
  222. sleep, 150
  223. send, {F3}
  224. sleep, 250
  225. send, %NomeMotora%
  226. sleep, 2500
  227. loop, 10
  228. {
  229. CoordMode, Pixel, Relative
  230. PixelSearch, X, Y, -972, 69, -659, 751, 0xFF9632 , 0, Fast RGB
  231. if (errorlevel = 0)
  232. {
  233. AchouMotora := 1
  234. X2 := X+1624
  235. Y2 := Y+26
  236. send, {click, %X2%, %Y2%}
  237. sleep, 300
  238. MouseGetPos, XButton, YButton
  239. sleep, 50
  240. XAtivar := XButton-162
  241. YAtivar := YButton+102
  242. XDesativar := XButton-141
  243. YDesativar := YButton+160
  244. PerfilX := XButton-162
  245. PerfilY := YButton+50
  246. sleep, 250
  247. send, ^{click, %PerfilX%, %PerfilY%}
  248. sleep, 1000
  249. send, ^{2}
  250. sleep, 500
  251. loop
  252. {
  253. CoordMode, Pixel, Relative
  254. PixelSearch, X, Y, 412, 279, 677, 311, 0x171717 , 5, Fast RGB
  255. if (errorlevel = 0)
  256. {
  257. break
  258. }
  259. else if (errorlevel = 1)
  260. {
  261. send, ^{2}
  262. sleep, 500
  263. }
  264. }
  265. sleep, 500
  266. CoordMode, Pixel, Relative
  267. PixelSearch, X, Y, 410, 332, 1071, 429, 0xF23D4F , 5, Fast RGB
  268. if (errorlevel = 1)
  269. {
  270. sleep, 1200
  271. WinGetTitle, Title, A
  272. Controlclick, x1483 y366, %Title%,, Left, 2, NA
  273. sleep, 50
  274. ControlClick, x1057 y545, %Title%,, Left, 3, NA
  275. sleep, 50
  276. send, ^{c}
  277. clipwait
  278. sleep, 100
  279. IdMotora := ClipBoard
  280. sleep, 150
  281. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= IdMotora
  282. ControlClick, x529 y535, %Title%,, Left, 3, NA
  283. sleep, 50
  284. send, ^{c}
  285. clipwait
  286. sleep, 100
  287. CPF := ClipBoard
  288. sleep, 150
  289. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= CPF
  290. ControlClick, x562 y641, %Title%,, Left, 3, NA
  291. sleep, 50
  292. send, ^{c}
  293. clipwait
  294. sleep, 100
  295. Telefone := ClipBoard
  296. sleep, 150
  297. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Telefone
  298. ControlClick, x1137 y641, %Title%,, Left, 3, NA
  299. sleep, 50
  300. send, ^{c}
  301. clipwait
  302. sleep, 100
  303. Email := ClipBoard
  304. sleep, 150
  305. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= Email
  306. sleep, 100
  307. ControlClick, x556 y781, %Title%,, Left, 2, NA
  308. sleep, 50
  309. send, ^{c}
  310. clipwait
  311. sleep, 100
  312. StatusMotora := ClipBoard
  313. sleep, 150
  314. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= StatusMotora
  315. ControlClick, x605 y808, %Title%,, Left, 3, NA
  316. sleep, 50
  317. send, ^{c}
  318. clipwait
  319. sleep, 100
  320. DataCadastro := ClipBoard
  321. sleep, 150
  322. XL.ActiveCell.Offset(0, 1).PasteSpecial Paste:= DataCadastro
  323. send, ^{w}
  324. sleep, 250
  325. XL.ActiveCell.OffSet(1, -6).Activate
  326. sleep, 50
  327. NomeMotora := "`r`n"
  328. IdMotora := "`r`n"
  329. CPF := "`r`n"
  330. Telefone := "`r`n"
  331. Email := "`r`n"
  332. StatusMotora := "`r`n"
  333. DataCadastro := "`r`n"
  334. break
  335. }
  336. if (errorlevel = 0)
  337. {
  338. XL.ActiveCell.Offset(1, 0).Select
  339. }
  340. }
  341. else if (errorlevel = 1)
  342. {
  343. send, {wheeldown}
  344. sleep, 50
  345. send, {wheeldown}
  346. sleep, 50
  347. send, {wheeldown}
  348. sleep, 50
  349. send, {wheeldown}
  350. sleep, 500
  351. }
  352. }
  353. }
  354. Return
  355.  
  356. ;;inativar placas
  357. *f8::
  358. WinGetTitle, Title, A
  359. loop
  360. {
  361. XL.ActiveCell.Copy
  362. ClipWait
  363. sleep, 150
  364. if (Clipboard = "`r`n")
  365. {
  366. sleep, 50
  367. XL.Visible := true
  368. DllCall("user32.dll\LockWorkStation")
  369. Return
  370. }
  371. ControlClick, x340 y346, %Title%,, Left, 2, NA
  372. sleep, 50
  373. send, ^{a}
  374. sleep, 50
  375. send, ^{v}
  376. sleep, 50
  377. send, {enter}
  378. sleep, 50
  379. Clipboard := "`r`n"
  380. sleep, 500
  381. Loop
  382. {
  383.   CoordMode, Pixel, Relative
  384.   PixelSearch, X, Y, 1598, 102, 1851, 840, 0x3483FA , 5, Fast RGB
  385.   if errorlevel = 0
  386.   break
  387. }
  388. sleep, 350
  389. ControlClick, x1818 y556, %Title%,, Left, 1, NA
  390. sleep, 100
  391. ControlClick, x1660 y725, %Title%,, Left, 1, NA
  392. sleep, 100
  393. XL.ActiveCell.Interior.Color := 0x97DBED
  394. sleep, 20
  395. XL.ActiveCell.Offset(1, 0).Select
  396. sleep, 200
  397. }
  398. return
  399.  
  400.  
  401. AbrirLista:
  402. WinActivate, ahk_exe msedge.exe
  403. WinWaitActive, ahk_exe msedge.exe
  404. sleep, 150
  405. send, {F3}
  406. sleep, 100
  407. send, Mostrar
  408. sleep, 1200
  409. send, {click, 83, 907}
  410. sleep, 150
  411. loop, 30
  412. {
  413. Send, {click, 967, 981}
  414. sleep, 200
  415. }
  416. Return
  417.  
  418.  
  419. *F6::
  420. Pause
  421. Return
  422.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement