xManh Posted September 25, 2006 Share Posted September 25, 2006 For example I run a Dos command Run(@ComSpec & " /c " & $command, "", @SW_HIDE) return $result How to know if the command is successful? thnx Link to comment Share on other sites More sharing options...
jinxter Posted September 25, 2006 Share Posted September 25, 2006 what command are you running ? > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
MHz Posted September 25, 2006 Share Posted September 25, 2006 (edited) I'm fairly sure you may get a return of 1 or 0 by running @ComSpec directly. $result = Run(@ComSpec & " /c " & $command, "", @SW_HIDE) MsgBox(0, '', $result) A cmd file in comparison can return varing int value from running a command. Edit: Cmd file can use return values beyond the limit of 0 and 1. Edited September 25, 2006 by MHz Link to comment Share on other sites More sharing options...
xManh Posted September 26, 2006 Author Share Posted September 26, 2006 I'm not sure It return variate integer values, some are very big (2023,3420,5050...) Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 26, 2006 Share Posted September 26, 2006 I'm fairly sure you may get a return of 1 or 0 by running @ComSpec directly. $result = Run(@ComSpec & " /c " & $command, "", @SW_HIDE) MsgBox(0, '', $result) oÝ÷ Ø&uø¥z)Ü¢jZ®+(Ƨën®{Ú®)à{oj[~º&®éçxr¦jwDv+B×âçëën®{Úç¬mì¨ÛazX¦ÚÑ©Ý×ú®¢×¶§Áó槵§Y¨{-y§h}§N«zÛ«ö¥¹çë¢dn+-êk¡Ç¬°è~Ø^ ¥ç¢{(êk¡Ç¬²)íç±jjexò¢ë¬y§Y¨¶§ÚÞ¶êç²Ø^zºè®W¯zWë¢kayÊ&©ÝJ¨¹Æ§~ÞÅ©©è¶Ø^zºè®W¯zWë¢cDMDjëh×6$ExtCmd = "NET USE X: \\MyServer\MyShare * /USER:MyUser /PERSISTENT:NO" $RetCode = RunWait($ExtCmd, @TempDir, @SW_MINIMIZE) If $RetCode = 0 Then MsgBox(64, "Success", "Successfully mapped X: drive.") Else MsgBox(16, "Error", "Error mapping X: drive, ERRORLEVEL = " & $RetCode) EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
xManh Posted September 26, 2006 Author Share Posted September 26, 2006 Well I see. But is there a way to track the progress If I don't runwait. Like Initget, I can choose 1 to download at background? Link to comment Share on other sites More sharing options...
MHz Posted September 26, 2006 Share Posted September 26, 2006 @PsaltyDSThanks for the correction as RunWait() returns the exit code where Run() returns Pid .@xManhTo use Run() so your script can do other things, then you can use some dllcalls to get the exit code from the process. Look at the link below.http://www.autoitscript.com/forum/index.php?showtopic=23096 Link to comment Share on other sites More sharing options...
xManh Posted September 26, 2006 Author Share Posted September 26, 2006 Thanks for recommendation MHz Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 26, 2006 Share Posted September 26, 2006 Thanks for recommendation MHzYou still haven't said what $command was in your first example. If it outputs some kind of status to StdOut, then you can use Run() with $STDOUT_CHILD and the StdOutRead() function. Just another option... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ragman Posted October 5, 2006 Share Posted October 5, 2006 You still haven't said what $command was in your first example. If it outputs some kind of status to StdOut, then you can use Run() with $STDOUT_CHILD and the StdOutRead() function. Just another option... Heh...I like the stdout option, but have found an issue with it. Say your running the command 'findstr', and the file you are doing the search on does not contain the string you are looking for, a race condition is created. I've yet to find an elegant way around this, but I am still very new to autoit. 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