CoffeeMan Posted August 31, 2019 Share Posted August 31, 2019 At the start of a script, I want a line of code that allows me to, in the future, while the program is executing to stop it midway. I am a total noob when it comes to programming so a lot of this stuff is confusing to me. Can someone explain this to me as if I knew nothing about programming? Link to comment Share on other sites More sharing options...
Danp2 Posted August 31, 2019 Share Posted August 31, 2019 Look at the help file examples for the HotKeySet command. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 1 minute ago, Danp2 said: Look at the help file examples for the HotKeySet command. How do I access the help file? Link to comment Share on other sites More sharing options...
Nine Posted August 31, 2019 Share Posted August 31, 2019 You need to install autoit from here. Once installed go to the autoit folder (usually C:\Program Files (x86)\AutoIt3). There is a file called AutoIt.chm. Double-click on it... “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 Thank you, I think I figured it out now. In order to test if this works, I wrote down this simple program: ; capture and pass along a keypress HotKeySet("{Esc}", "captureEsc") Func captureEsc() ; ... can do stuff here HotKeySet("{Esc}") Send("{Esc}") HotKeySet("{Esc}", "captureEsc") EndFunc WinActivate("Untitled") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") Send("johiguytfcrvyguhijkopjouyv") However, nothing happened. I think I am doing something wrong. Do I need to call the function? Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 To further elaborate, I mean nothing happened when pressing ESC. I planned for it to spam notepad and I would be able to push ESC to stop it, but nothing happened. Link to comment Share on other sites More sharing options...
Nine Posted August 31, 2019 Share Posted August 31, 2019 add this line in your captureEsc () function. Exit “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 1 minute ago, Nine said: add this line in your captureEsc () function. Exit OH MY GOD, IT WORKS! THANK YOU SO MUCH! I didn't want to mention this earlier because I thought it would fix itself, but I have another problem. For whatever reason, the code: ; capture and pass along a keypress HotKeySet("{Esc}", "captureEsc") Func captureEsc() ; ... can do stuff here HotKeySet("{Esc}") Send("{Esc}") HotKeySet("{Esc}", "captureEsc") Exit EndFunc WinActivate("Untitled") ; insert other send() code here Whenever the Send() code runs it simultaneously writes to Notepad while also writing to the AutoIt code editor. What am I doing wrong? Also, in the forum's built-in code block I see that "and pass" is highlighted in blue. Did I initialize the comment correctly? Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 Note: comment looks fine on editor. Link to comment Share on other sites More sharing options...
Nine Posted August 31, 2019 Share Posted August 31, 2019 Send command is not the most robust way to transmit keystrokes to an application. You should consider more reliable function like ControlSend () or others. To better help you what is the application you want to automate ? “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 18 minutes ago, Nine said: Send command is not the most robust way to transmit keystrokes to an application. You should consider more reliable function like ControlSend () or others. To better help you what is the application you want to automate ? Right now all I want to automate is Notepad. I'll try the ControlSend() function and report back to you with my results. Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 30 minutes ago, Nine said: Send command is not the most robust way to transmit keystrokes to an application. You should consider more reliable function like ControlSend () or others. To better help you what is the application you want to automate ? Ok, so I am back. I looked at the help documentation for controlsend() and it seems out of my league. The parameters seem complicated and the function listed below the parameters seemed even more complicated. But, if we are to tackle this one issue at a time, here is the labeled stuff in the doc: ControlSend ( "title", "text", controlID, "string" [, flag = 0] ) What is a title, controlID, and a flag? What is the proper way to write in Notepad with this function? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2019 Developers Share Posted August 31, 2019 3 minutes ago, CoffeeMan said: I looked at the help documentation for controlsend() and it seems out of my league. 4 minutes ago, CoffeeMan said: What is a title, controlID, and a flag? What is the proper way to write in Notepad with this function? Well this question simply means to me you haven't really read anything ...did you? ... as the example shown for the function tells you how it works with Notepad. ... but having said that: Let's cut the BS about automating Notepad and simply state which program you really want to SPAM here? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted August 31, 2019 Share Posted August 31, 2019 (edited) 6 minutes ago, CoffeeMan said: What is the proper way to write in Notepad with this function? Use AutoItWindowInfoTool to obtain those information (Title, optional text, and ControlID) from the application you are trying to automate EDIT: Sorry @Jos. Replied one second after you did! Edited August 31, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 5 minutes ago, Jos said: Well this question simply means to me you haven't really read anything ...did you? ... as the example shown for the function tells you how it works with Notepad. ... but having said that: Let's cut the BS about automating Notepad and simply state which program you really want to SPAM here? Jos I don't really have anything in mind at the moment, but I am hoping that this language will help me automate repetitive tasks on my computer such as file creation. My friend also started out with this language so I thought I should give it a shot. Do you have any recommendations for future goals I should shoot towards? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2019 Developers Share Posted August 31, 2019 Honestly do not believe you came here with simply no idea what you need it for and then come up with the grand idea to Spam Notepad. On top of that, as stated, you show all signs of somebody that isn't willing to go through a normal learning process by spending time reading the information provided properly. So let's keep it simple and tell us what you are really after. Jos ps: By the way: also ensure you read our forum rules properly as well as I have the feeling you are potentially going to use AutoIt3 for game automation. Fine when you do but do not discuss any of it in these forums, also not call that game Notepad! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 1 minute ago, Jos said: Honestly do not believe you came here with simply no idea what you need it for and then come up with the grand idea to Spam Notepad. On top of that, as stated, you show all signs of somebody that isn't willing to go through a normal learning process by spending time reading the information provided properly. So let's keep it simple and tell us what you are really after. Jos ps: By the way: also ensure you read our forum rules properly as well as I have the feeling you are potentially going to use AutoIt3 for game automation. Fine when you do but do not discuss any of it in these forums, also not call that game Notepad! I do have my own goals in mind but I am unsure of where to begin. There aren't that many tutorials of AutoIt online so I saw a YouTube video showcasing the NotePad script. I am fully aware of the rules and that discussing ways to automate software which forbids it in its own ToS as well as game automation is completely forbidden on the forums. I am sorry if I came off as a bit ignorant in my posts. You are right, I should read the help documentation more thoroughly before asking questions. I never meant to upset a developer on my first day here, please forgive me. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2019 Developers Share Posted August 31, 2019 There is a lot of information available for starters.. the helpfile contains a lot of basic info and you'll find a lot of information in the provided Wiki and these forums when you are willing to do a little research. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CoffeeMan Posted August 31, 2019 Author Share Posted August 31, 2019 3 minutes ago, Jos said: There is a lot of information available for starters.. the helpfile contains a lot of basic info and you'll find a lot of information in the provided Wiki and these forums when you are willing to do a little research. Jos Thanks. If I have any more questions later down the road, after thoroughly reading the helpfile, the forum, and the wiki I guess I'll make a new thread since this one has outlived its purpose. Until then, thank you so much for the help. Werty 1 Link to comment Share on other sites More sharing options...
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