telmob Posted April 9, 2020 Posted April 9, 2020 (edited) I'm trying to run the loop below for 80 times, but it always exits much sooner. Am i doing something wrong? It's been a while since i use AutoIt. HotKeySet("{ESC}", "Exit") HotKeySet("+;", "GenerateBarcode") ; Shift-Alt-d While 1 Sleep(100) WEnd Func Exit() Exit EndFunc ;==>Exit Func GenerateBarcode() For $i = 80 To 1 Step -1 MouseWheel("down",50) MouseClick("left",171,296,1) MouseClick("left",171,316,1) MouseClick("left",171,336,1) MouseClick("left",171,356,1) MouseClick("left",171,376,1) MouseClick("left",171,396,1) MouseClick("left",171,416,1) MouseClick("left",171,436,1) MouseClick("left",171,456,1) MouseClick("left",171,476,1) Sleep(500) MouseClick("left",1256,170,1) MouseClick("left",1256,190,1) MouseClick("left",1256,210,1) Sleep(1000) MouseClick("left",1256,290,1) Next Exit EndFunc ;==>GenerateBarcode Edited April 10, 2020 by telmob Solved.
faustf Posted April 9, 2020 Posted April 9, 2020 try this mod for your program bye ShowMessage() Func ShowMessage() For $i = 0 To 80 ConsoleWrite ("de made ") Next Exit EndFunc ;==>GenerateBarcode
telmob Posted April 9, 2020 Author Posted April 9, 2020 (edited) 42 minutes ago, faustf said: try this mod for your program bye ShowMessage() Func ShowMessage() For $i = 0 To 80 ConsoleWrite ("de made ") Next Exit EndFunc ;==>GenerateBarcode Ended at 14. The writing in the console worked, but not the mouseclick. Edit: Thank you for your reply. Edited April 10, 2020 by telmob
FrancescoDiMuro Posted April 10, 2020 Posted April 10, 2020 @telmob Mouse* functions are not very reliable for automate applications. Which application are you trying to automate? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
telmob Posted April 10, 2020 Author Posted April 10, 2020 7 hours ago, FrancescoDiMuro said: @telmob Mouse* functions are not very reliable for automate applications. Which application are you trying to automate? My company's ERP in Chrome. I need to generate a barcode manually for each product, and those are the steps i need to take for each product. I said i need to loop it 80 times before, but it's actually more than 3300.
Nine Posted April 10, 2020 Posted April 10, 2020 13 hours ago, telmob said: Ended at 14. The writing in the console worked, but not the mouseclick. Not sure I understand what you mean. What exactly is working and what is not. So you say it ended prematurely, unless there is code elsewhere, I do not think it is possible. 14 minutes ago, telmob said: My company's ERP in Chrome maybe look at : “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
telmob Posted April 10, 2020 Author Posted April 10, 2020 22 minutes ago, Nine said: Not sure I understand what you mean. What exactly is working and what is not. So you say it ended prematurely, unless there is code elsewhere, I do not think it is possible. maybe look at : Thanks for your help. The execution behaves erratically. Below if the full code. This time it reached 16... go figure. Doesn't make any sense to me. Maybe it's stressing the system too much!? (which i doubt) HotKeySet("{ESC}", "Exiter") HotKeySet("+;", "GenerateBarcode") ; Shift-Alt-d While 1 Sleep(100) WEnd Func Exiter() Exit EndFunc ;==>Terminate Func GenerateBarcode() For $i = 0 to 80 MouseWheel("down",50) MouseClick("left",171,296,1) MouseClick("left",171,316,1) MouseClick("left",171,336,1) MouseClick("left",171,356,1) MouseClick("left",171,376,1) MouseClick("left",171,396,1) MouseClick("left",171,416,1) MouseClick("left",171,436,1) MouseClick("left",171,456,1) MouseClick("left",171,476,1) Sleep(500) MouseClick("left",1256,170,1) MouseClick("left",1256,190,1) MouseClick("left",1256,210,1) Sleep(1000) MouseClick("left",1256,290,1) ConsoleWrite($i & " ") Next Exit EndFunc ;==>GenerateBarcode I'll see if i can use WebDriver.
telmob Posted April 10, 2020 Author Posted April 10, 2020 SOLVED! The freaking Antivirus was the problem. It stopped the script, for some reason. Stopped the AV and now it's working perfectly. Oh well... Btw, i'm using Webroot SecureAnywhere. (was!)
Nine Posted April 10, 2020 Posted April 10, 2020 58 minutes ago, telmob said: Stopped the AV and now it's working perfectly. Figure. Don't know this particular AV, but with most of them, you can exclude (white list) some folders/files “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
telmob Posted April 10, 2020 Author Posted April 10, 2020 4 minutes ago, Nine said: Figure. Don't know this particular AV, but with most of them, you can exclude (white list) some folders/files That's a good idea. Thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now