darzanmihai Posted May 21, 2010 Share Posted May 21, 2010 (edited) I want to shellexecute with parameters a file that will convert a database to excel, but sometimes the database is corupt or is of another type and then it displays an error message in the comand prompt window and it stays this way unlimited time. What I want to do is read the messages that the database converter outputs in the command prompt window so that I know if it succeded or failed. Could someone please guide me? Edited May 21, 2010 by darzanmihai I do not like stupid and idiot people that write idiot things...If you are one, do not write. Link to comment Share on other sites More sharing options...
JohnOne Posted May 21, 2010 Share Posted May 21, 2010 I know very little about this, but I would guess that you would need to use the Run() function rather than shellexecute in order to get the PID of the programm you are running, then you want to be looking at StdoutRead(). AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
99ojo Posted May 21, 2010 Share Posted May 21, 2010 (edited) Hi, have a look in helpfile at StdoutRead example. Built you Run command with the params you need to execute your conversion exe. If you need to masquerade you params with ", have a look in helpfile -> Language Reference -> Datatypes: Strings If you need further help, come back. ;-)) Stefan @JohnOne beats me... Edited May 21, 2010 by 99ojo Link to comment Share on other sites More sharing options...
water Posted May 21, 2010 Share Posted May 21, 2010 Use "Run" and set "opt_flag" to "$STDOUT_CHILD". With "StdOutRead" you can get the output of your program. See the helpfile for "StdOutRead". There you'll find an example. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
darzanmihai Posted May 21, 2010 Author Share Posted May 21, 2010 Hi, have a look in helpfile at StdoutRead example. Built you Run command with the params you need to execute your conversion exe. If you need to masquerade you params with ", have a look in helpfile -> Language Reference -> Datatypes: Strings If you need further help, come back. ;-)) Stefan @JohnOne beats me... Thx all for help. I tied the code: $hdl = Run(@ComSpec & " /c " &"paradox-dbase-reader.exe -c -i "&$FilePath&"\"&$table_list[$i]&".db -o "&@ScriptDir&"\Export_temp\ -f excel",@ScriptDir,@SW_SHOW,$STDOUT_CHILD) $line="" While 1 $line = StdoutRead($hdl) If @error Then ExitLoop If $line<>"" Then ConsoleWrite($line&@CRLF) Wend but the stdout returns nothing... I do not like stupid and idiot people that write idiot things...If you are one, do not write. Link to comment Share on other sites More sharing options...
water Posted May 21, 2010 Share Posted May 21, 2010 Thx all for help. I tied the code: $hdl = Run(@ComSpec & " /c " &"paradox-dbase-reader.exe -c -i "&$FilePath&"\"&$table_list[$i]&".db -o "&@ScriptDir&"\Export_temp\ -f excel",@ScriptDir,@SW_SHOW,$STDOUT_CHILD) Consolewrite("Hdl: " & $hdl & ", Error: " & @error & @CRLF) $line="" While 1 $line = StdoutRead($hdl) If @error Then ExitLoop If $line<>"" Then ConsoleWrite($line&@CRLF) Wend but the stdout returns nothing... You don't specify a path where the exe should reside. I added a ConsoleWrite after the Run to check if the processId is returned. If $Hdl = 0 then the exe hasn't been started successfully. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
darzanmihai Posted May 25, 2010 Author Share Posted May 25, 2010 You don't specify a path where the exe should reside. I added a ConsoleWrite after the Run to check if the processId is returned. If $Hdl = 0 then the exe hasn't been started successfully. the cmd line executable resides in the same folder as the script, but anyway I modified the code: $hdl = Run(@ComSpec & " /c " &@ScriptDir&"\paradox-dbase-reader.exe -c -i "&$FilePath&"\"&$table_list[$i]&".db -o "&@ScriptDir&"\Export_temp\ -f excel",@ScriptDir,@SW_SHOW,$STDOUT_CHILD) Consolewrite("Hdl: " & $hdl & ", Error: " & @error & @CRLF) $line="" While 1 $line = StdoutRead($hdl) If @error Then ExitLoop If $line<>"" Then ConsoleWrite($line&@CRLF) Wend The executable is runed corectly and it does its job, but I cannot catch its output on the command prompt window... the StdoutRead() returns nothing I need to catch what it returns on the command prompt in order to know if it has finished - see picture - or it has an error (because if it finishes it stays open). I do not like stupid and idiot people that write idiot things...If you are one, do not write. Link to comment Share on other sites More sharing options...
wakillon Posted May 25, 2010 Share Posted May 25, 2010 Instead of StdoutRead try with StderrRead ( don't forget $STDERR_CHILD ) may be it give an error code... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
darzanmihai Posted May 26, 2010 Author Share Posted May 26, 2010 Instead of StdoutRead try with StderrRead ( don't forget $STDERR_CHILD )may be it give an error code......Nothing.....absolutelly nothing. It returns "". The only thing it returns is "^C" when I manually close the cmd window.Do you have another ideea, please? I do not like stupid and idiot people that write idiot things...If you are one, do not write. Link to comment Share on other sites More sharing options...
water Posted May 26, 2010 Share Posted May 26, 2010 ...Nothing.....absolutelly nothing. It returns "". The only thing it returns is "^C" when I manually close the cmd window.Do you have another ideea, please?I get the impression that the exe doesn't write to StdOut. Maybe it's a kind of GUI that mimics a console.Could you start AutoIt's WindowInfo tool and check if you get any results? Use the Finder Tool (crosshair icon) and point to the Paradox Database window. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
darzanmihai Posted May 26, 2010 Author Share Posted May 26, 2010 I get the impression that the exe doesn't write to StdOut. Maybe it's a kind of GUI that mimics a console.Could you start AutoIt's WindowInfo tool and check if you get any results? Use the Finder Tool (crosshair icon) and point to the Paradox Database window.Au3info returns nothing. This is a CUI. Anyway I resolved the issue, by using another cmd line parameter -e to exit after finishes.... I'm so dumb I didn't saw it in the first place.Thx anyway for the effortMihai I do not like stupid and idiot people that write idiot things...If you are one, do not write. 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