zimmer Posted August 1, 2023 Share Posted August 1, 2023 Hello, I've two questions and if anybody knows or can help me with the explanations with examples it would be awesome. 1) How to handle errors with Clickpath? For instance, I've run the program with WinWait -> then WinActivate then MouseClick. During that Program exited with the error. Let's say that some .dll file wasn't found or something similar. Is there any way to catch up on the error in that case and send it to the Slack channel so I will know if something went wrong with the task? 2) I tried to send the message with the curl to the slack but I can't make it work. This is my code example : Global Const $sURL = "https://hooks.slack.com/services/api-sjhkjhdhkjhas" Global Const $sData = "Error" Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") EndFunc I have no idea why I used Global const but I saw some of the examples here by using this kind of methodology. Thank you. When the words fail..rephrase them 😄 no one gives a single f9xck Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 (edited) 1. Check for error before it is thrown. If you know that a dll might be missing maybe it's a good idea to check if all required files are in place else inform the user about that. 2. Your code just assign some data to variables and also contain a function that is never called. What exactly should work or not work in your example since it's not suppose to do anything? Probably it's a good idea to learn basics of AutoIt. There is a well put together help file with plenty of examples and some examples/tutorials here on the forum. Edited August 1, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
zimmer Posted August 1, 2023 Author Share Posted August 1, 2023 4 minutes ago, Andreik said: 1. Check for error before it is thrown. If you know that a dll might be missing maybe it's a good idea to check if all required files are in place else inform the user about that. 2. Your code just assign some data to variables and also contain a function that is never called. What exactly should work or not work in your example since it's not suppose to do anything? Probably it's a good idea to learn basics of AutoIt. There is a well put together help file with plenty of examples and some examples/tutorials here on the forum. Yeah, checking the error with the IF state I suppose. My code is just an example of failure it's not supposed to work, in another case, I wouldn't ask some basic questions. I agree, learning basics is what I'm trying to achieve now. BUT! No offence to anyone but the documentation doesn't help much, especially examples some of which even don't work in copy/paste way. When the words fail..rephrase them 😄 no one gives a single f9xck Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 (edited) You are insulting the dev team that made a well documented help file for each function with examples and each piece of code run just properly. Saying that sample codes from help file doesn't work actually says much about your understanding level, so I stick with my suggestion: get the basics and then you can get help for more complex tasks. Edited August 1, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
zimmer Posted August 1, 2023 Author Share Posted August 1, 2023 Insulting? So, giving honest feedback is insulting? I asked a question and you pointed me to go and learn the basics, well it still doesn't seem like to any discussion, help or answer. When the words fail..rephrase them 😄 no one gives a single f9xck Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 It's not honest feedback when you say some examples doesn't work since every piece of code from help file works. You already said in your first post that you don't even know what global const means, so you don't know basics. You can stay here and argue or you can go and learn basics in order to be able to formulate a question and get help for your specific task. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
zimmer Posted August 1, 2023 Author Share Posted August 1, 2023 lol, that's how you judge people? By Global, Local and DIM? Can you specify which examples you mean, those which are in the wiki or those which are in the help file? When the words fail..rephrase them 😄 no one gives a single f9xck Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 I don't judge anything, I made an observation that you want to code when you don't know basics, which is kinda impossible (probably ChatGPT can help you). I wrote like 3 times that proper way is to understand basics with examples from help file since some UDFs on wiki and forum might be outdated. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
argumentum Posted August 1, 2023 Share Posted August 1, 2023 35 minutes ago, zimmer said: When the words fail..rephrase them 😄 no one gives a single f9xck ...that's the kind of troll it is. Beware of addiction Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 When programming becomes frustrating the only remaining thing it's to troll. I had to wait like 10 years for this image so I can use it anywhere. Now it's the time. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
zimmer Posted August 1, 2023 Author Share Posted August 1, 2023 Why r u so serious? 😁 If (senseOfHumour = true) { return "Smile" }else { "Probably it's a good idea to learn the basics of humour" } rsn 1 When the words fail..rephrase them 😄 no one gives a single f9xck Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 You can bark more around the forum but you just proved my point again by posting a pseudo script having so many problems in just 4 lines of code. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
philpw99 Posted August 6, 2023 Share Posted August 6, 2023 @zimmer Both of your questions did show huge problems of your understanding of the AutoIt. Well, I think it's better to explain than to argue. 1. How to handle errors with Clickpath? I think you are trying to understand how AutoIt handles mouse clicks. I am no expert but I knows 3 ways. 1) Create your GUI components by using GUICreate() and GuiCtrlCreateXXXX(). Then use GuiGetMsg() to receive events like mouse clicks for GUI and controls. This is the most common way. 2) Just like above, create GUI components in AutoIt, assign each control a handling function by using GUICtrlSetOnEvent(), then start the event mode by setting opt("GUIOnEventMode", 1) When a mouse click happens on a control, the handling function will get called. 3) Monitor mouse clicks by making your own WM_Message handling function, then use GuiRegisterMsg() to capture all the events, including mouse clicks. This requires some good understanding of WM_Messaging and how those things work. It's at a more advanced level. Now your question is about "handle errors with click path", which "click path" not exist in AutoIt, then later you used a strange procedure to explain. Well, "winwait", "WinActivate" and mouse click on what ? And what dll error showed up? Did you intend to click on an AutoIt program or other program? That's basic thing we need to know. 2. I tried to send the message with the curl to the slack but I can't make it work. Your program is just a function which creates a WinHttp request object, but then nothing is done. You still need to: 1) In the function, call the open method like '$oHttp.Open( "GET", $sURL)' to make it do something and return some value. Reference: https://learn.microsoft.com/en-us/windows/win32/winhttp/iwinhttprequest-open If you need to do the post, I suggest you use the excellent "WinHttp.au3" by Dragana R. instead. 2) You still need to call the "HttpPost" function in the main routine. Otherwise the whole function will just get ignored. 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