Guest Philipm Posted February 20, 2005 Posted February 20, 2005 Hi Everyone, I have just started using AutoIT and I have to say I LOVE IT. I am however facing a slight problem; I have written and compiled a short script to detect when dialog boxes appear. The resulting compiled script is called from a VB script. What I need to do is pass back to the VB script a number, from the AutoIt compiled script when certain dialogs are thrown. I cant seem to find a way to do this!!!! From what I can see, AutoIT doesnt seem to implement StdOut or StdErr functionality...and I tried using the Exit funtion to return a number and then using VB script to read the %errorlevel%, but this seems to always return a value of 0 once the script has completed. Is there somthing I am doing incorrectly???? Any help or ideas alaways appreciated. Phil
Blue_Drache Posted February 20, 2005 Posted February 20, 2005 Hi Everyone,I have just started using AutoIT and I have to say I LOVE IT. I am however facing a slight problem;I have written and compiled a short script to detect when dialog boxes appear. The resulting compiled script is called from a VB script. What I need to do is pass back to the VB script a number, from the AutoIt compiled script when certain dialogs are thrown. I cant seem to find a way to do this!!!!From what I can see, AutoIT doesnt seem to implement StdOut or StdErr functionality...and I tried using the Exit funtion to return a number and then using VB script to read the %errorlevel%, but this seems to always return a value of 0 once the script has completed.Is there somthing I am doing incorrectly????Any help or ideas alaways appreciated.Phil<{POST_SNAPBACK}>you could always write the number to an .ini file. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
sugi Posted February 20, 2005 Posted February 20, 2005 Just end your AutoIt script with "Exit <number>":Exit 5Then your VB script should be able to simply use the return value of the AutoIt script to proceed as needed.
Guest Philipm Posted February 20, 2005 Posted February 20, 2005 you could always write the number to an .ini file.<{POST_SNAPBACK}>Thanks for the help Sugi, but your suggestion doesnt seem to work. I assume that once a script is terminated with an Exit <number>, I should be able to read back the number from %errorlevel%. The errorlevel however does not seem to be set correctly, always resulting in 0, no matter what number I exit with.Also...is the syntax for Exit, Exit <number> or Exit (<number>) with the parenthesis???TIA....Phil
MSLx Fanboy Posted March 11, 2005 Posted March 11, 2005 If I remember correctly, its exit (number). exit(0) or exit(15) Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
therks Posted March 11, 2005 Posted March 11, 2005 (edited) Exit [return code]return code :: [optional] Integer that sets the script's return code. This code can be used by Windows or the DOS variable %ERRORLEVEL%. The default is 0. Scripts normally sets an errorlevel of 0 if the script executed properly; error levels 1 and above typically indicate that the script did not execute properly. RemarksThe parameter, if included, can be enclosed in parentheses. Thus, the following are equivalent: Exit, Exit 0, and Exit(0). However, Exit() is invalid.*Edit: And this seems to work fine with a batch file.test.au3Exit 4test.bat@echo off test.au3 echo au3 errorlevel: %errorlevel% test.exe echo exe errorlevel: %errorlevel%resultau3 errorlevel: 4 exe errorlevel: 4Guess it's a VBScript problem. Edited March 11, 2005 by Saunders My AutoIt Stuff | My Github
zvd Posted March 11, 2005 Posted March 11, 2005 Don't know if this helps, but I was able to return a value with SetError: vb.au3 SetError (2) RunWait(@ComSpec & " /c c:\temp\vb.vbs " & @error ) vb.vbs Set objArgs = Wscript.Arguments Wscript.Echo "Error Number: ", objArgs.item(0)
therks Posted March 13, 2005 Posted March 13, 2005 I think he wants to do the reverse. He wants to use VBScript to run an AutoIt script and retrieve a value from it. You don't even need to use SetError to implement your example. If you RunWait(@ComSpec & " /c c:\temp\vb.vbs helloHelloHELLO") It will work the same way. My AutoIt Stuff | My Github
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