grasshopper Posted May 16, 2005 Posted May 16, 2005 what is the syntax for reading and displaying the return value from AutoIT functions.
steveR Posted May 16, 2005 Posted May 16, 2005 You would assign a varible to the return value: $var = function() AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
grasshopper Posted May 16, 2005 Author Posted May 16, 2005 and then msgbox with the $var in it <{POST_SNAPBACK}>thanks for the assistance SteveR and MARKMARKMARK.here is an example of the code that i worked on that used return codes:Run("notepad.exe") ;launches notepad editorWinWait ("Untitled - Notepad", "", 10) ;Pauses execution of the script until the requested window exists.$rtn00 = WinExists ("Untitled - Notepad", "") ;feeds result code of WinWait into var "$rtn00" If $rtn00 = 1 Then WinActivate ("Untitled - Notepad", "") ;Activates (gives focus to) a window. $rtn01 = WinActivate ("Untitled - Notepad") ;feeds result code of WinActivate into var "$rtn01" If $rtn01 = 1 Then ;if result = 1 goto next line of code, otherwise exit or display error message. MsgBox(0, "Status", "Window Has Been Activated. Notepad Editor Will Now Be Closed.") ;for testing purposes only. WinClose("Untitled - Notepad") ;close notepad editor Else MsgBox(0, "Status", "Unable To Activate window. This Script Will Now Exit.") ;for testing purposes only. Exit EndIfElse MsgBox(0, "Status", "Window Does Not Exist. This Script Will Now Exit.") ;for testing purposes only. Exit ;Window does not exist, exiting script.EndIf
Blue_Drache Posted May 16, 2005 Posted May 16, 2005 thanks for the assistance SteveR and MARKMARKMARK.here is an example of the code that i worked on that used return codes:Run("notepad.exe");launches notepad editor WinWait ("Untitled - Notepad", "", 10);Pauses execution of the script until the requested window exists. $rtn00 = WinExists ("Untitled - Notepad", "");feeds result code of WinWait into var "$rtn00" If $rtn00 = 1 Then WinActivate ("Untitled - Notepad", "");Activates (gives focus to) a window. $rtn01 = WinActivate ("Untitled - Notepad");feeds result code of WinActivate into var "$rtn01" If $rtn01 = 1 Then;if result = 1 goto next line of code, otherwise exit or display error message. MsgBox(0, "Status", "Window Has Been Activated. Notepad Editor Will Now Be Closed.");for testing purposes only. WinClose("Untitled - Notepad");close notepad editor Else MsgBox(0, "Status", "Unable To Activate window. This Script Will Now Exit.");for testing purposes only. Exit EndIf Else MsgBox(0, "Status", "Window Does Not Exist. This Script Will Now Exit.");for testing purposes only. Exit;Window does not exist, exiting script. EndIf<{POST_SNAPBACK}>While technically correct, assigning the value to a variable is not required.your If statement could be accomplished by:If WinActivate ("Untitled - Notepad") = 1 then Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
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