darzanmihai Posted May 21, 2010 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.
JohnOne Posted May 21, 2010 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.
99ojo Posted May 21, 2010 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
water Posted May 21, 2010 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: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
darzanmihai Posted May 21, 2010 Author Posted May 21, 2010 On 5/21/2010 at 9:15 AM, '99ojo said: 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.
water Posted May 21, 2010 Posted May 21, 2010 On 5/21/2010 at 10:14 AM, 'darzanmihai said: 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: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
darzanmihai Posted May 25, 2010 Author Posted May 25, 2010 On 5/21/2010 at 10:48 AM, 'water said: 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.
wakillon Posted May 25, 2010 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
darzanmihai Posted May 26, 2010 Author Posted May 26, 2010 On 5/25/2010 at 11:09 AM, 'wakillon said: 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.
water Posted May 26, 2010 Posted May 26, 2010 On 5/26/2010 at 11:00 AM, 'darzanmihai said: ...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: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
darzanmihai Posted May 26, 2010 Author Posted May 26, 2010 On 5/26/2010 at 11:17 AM, 'water said: 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.
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