khamis87 Posted October 10, 2008 Share Posted October 10, 2008 (edited) Hi everyone, I'm an AutoIt beginner & I have a little background in programing. My Q is: What does @error macro correspond to? I bet it used like this situation: WinActivate("[CLASS:Notepad]", "") So now @error value = 1 or 0 depending on the success or failure of the previous command What I want is getting the return value of any AutoIt function! I know how to use WinActive. But with other ACTION functions like WinActivate or ControlDisable it just didn't work for me. In both success or failure I get @error = 0 I use the latest beta version v3.2.12.1 [took the version # from the help file] Edited October 10, 2008 by khamis87 Link to comment Share on other sites More sharing options...
BrettF Posted October 10, 2008 Share Posted October 10, 2008 It is only for the last function. Not for any function you so pick Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
khamis87 Posted October 10, 2008 Author Share Posted October 10, 2008 It is only for the last function. Not for any function you so pick Cheers, Brettyeah I know but even when it follows a function, still it gives 0 in success or failure e.g. WinActivate("[CLASS:Notepad]", "") If @error Then MsgBox("", "", @error) Else MsgBox("", "", @error) EndIf In both cases, whether a Notepad window is activated or not I get a value of 0. Case1: There's an inactive windows & it's been activated. This is a success. 0 value!! [as it should give 1 as the return value] Case2: No such a window to activate. Failure. 0 value but it's ok. It's quite impossible that this beta version has something wrong with the @error. Link to comment Share on other sites More sharing options...
andybiochem Posted October 10, 2008 Share Posted October 10, 2008 Not all functions modify @error.Look in the help file for return values.In the case of WinActivate:"Return ValueSuccess: Returns 1. Failure: Returns 0 if window is not found or cannot be activated. "...so WinActivate doesn't modify @error at all. You'd need to do this:$return = WinActivate("[CLASS:Notepad]", "") If $return Then MsgBox("", "", $return) Else MsgBox("", "", $return) EndIf - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
khamis87 Posted October 10, 2008 Author Share Posted October 10, 2008 Not all functions modify @error. Look in the help file for return values. In the case of WinActivate: "Return Value Success: Returns 1. Failure: Returns 0 if window is not found or cannot be activated. " ...so WinActivate doesn't modify @error at all. You'd need to do this: $return = WinActivate("[CLASS:Notepad]", "") If $return Then MsgBox("", "", $return) Else MsgBox("", "", $return) EndIf It came to my mind that this is what I should do but I didn't check it lol anyways, thank you for your help I'll try to be more serious next time! 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