ptrex Posted December 14, 2006 Share Posted December 14, 2006 Maybe it's my lack of experience with stdout(), but I have several problems with it. Let' start with this one : #include <Constants.au3> ReadInfo() Func ReadInfo() local $info $info = Run("wmic csproduct","",@SW_HIDE,2); WMIC is the MS Commandline WMI solution While 1 $line = StdoutRead($Info) ConsoleWrite($line) If @error Then ExitLoop Wend EndFunc No result is given PS : The wmic runs only on XP and later. Any hint Thanks ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted December 14, 2006 Author Share Posted December 14, 2006 @all Just to let you know "wmic csproduct" is standard available in XP. Just open CMD and run this command "wmic csproduct" It will give you some output results. But not in AutoIT so far ?! any idea why ? Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted December 15, 2006 Author Share Posted December 15, 2006 (edited) No help from no one. Can at least someone confirm the same behaviour ? I this a bug or a limitation of AutoIT or a script error ? thanks ptrex Edited December 15, 2006 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
jpm Posted December 15, 2006 Share Posted December 15, 2006 No help from no one. Can at least someone confirm the same behaviour ?I this a bug or a limitation of AutoIT or a script error ?thanksptrexI test your script same behavior here.I try to launch with @comspec /c without any success.I am as you I don't know why the StdoutRead doc example is working and not yours.I need Valik or DaveF to jump in this analysis. :"> Link to comment Share on other sites More sharing options...
ptrex Posted December 15, 2006 Author Share Posted December 15, 2006 I test your script same behavior here.I try to launch with @comspec /c without any success.I am as you I don't know why the StdoutRead doc example is working and not yours.I need Valik or DaveF to jump in this analysis. :">@JpmI have more example that don't work. Try to use the Windows PowerShell cmdline tool.The same results.I am glad you responded !!regardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
jpm Posted December 15, 2006 Share Posted December 15, 2006 #include <Constants.au3> $foo = Run(@ComSpec & " /c wmic csproduct", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...") That the test I did. Have a look. The CMD does not end so I you run it from Scite and stop the debugging you will see a msgbox with the first line. That's remain me a lot of discussion about some application not delivering the dtdout buffer before closing. I don't remember if some go around as been found. Link to comment Share on other sites More sharing options...
ptrex Posted December 15, 2006 Author Share Posted December 15, 2006 (edited) Jpm Thanks so far. Let me kow if there was a solution found. This would open up doors. Because I intended to start using the MS PowerShell. And this is has big potentials also for AutoIT !! regards ptrex Edited December 15, 2006 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
DaveF Posted December 15, 2006 Share Posted December 15, 2006 Looks like WMIC expects some kind of input if it's not being run by the shell, I fed it a CRLF and it worked OK for me: Dim $pid, $ourOutput ; Open with connections to STDIN and STDOUT $pid = Run("wmic.exe csproduct", @SystemDir, @SW_HIDE, 3) StdinWrite($pid, @CRLF) ; Call with no string param to close STDIN StdinWrite($pid) While 1 $ourOutput &= StdoutRead($pid) If @error Then ExitLoop WEnd MsgBox(0, "", $ourOutput) Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 16, 2006 Share Posted December 16, 2006 (edited) Ptrex, when writing a program called MP3 to OGG, i noticed that all the command line encoders wrote to the $STDERR_CHILD stream. They just simply didn't write to the STDOUT stream even though they should have. I think this could very well be your problem. Edited December 16, 2006 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
jpm Posted December 16, 2006 Share Posted December 16, 2006 Looks like WMIC expects some kind of input if it's not being run by the shell, I fed it a CRLF and it worked OK for me: Dim $pid, $ourOutput ; Open with connections to STDIN and STDOUT $pid = Run("wmic.exe csproduct", @SystemDir, @SW_HIDE, 3) StdinWrite($pid, @CRLF) ; Call with no string param to close STDIN StdinWrite($pid) While 1 $ourOutput &= StdoutRead($pid) If @error Then ExitLoop WEnd MsgBox(0, "", $ourOutput)THanks DaveF, That's exactly what Valik was mentioning in a discussion with JON. Some applications don't deliver output until they stopped. I cannot remember if he was looking for a solution for those. Link to comment Share on other sites More sharing options...
ptrex Posted December 16, 2006 Author Share Posted December 16, 2006 (edited) @DaveF/Jpm Thanks you guys !!! This is the solution or workaround. Now it even works with the MS Powershell. You' ll be hearing more about this in the Example scripts. regards ptrex Edited December 16, 2006 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
jefhal Posted February 5, 2007 Share Posted February 5, 2007 Now it even works with the MS Powershell. ptrexHi Ptrex- Can you show an example with PowerShell? Here's the PowerShell line that I'd like to collect inside of AutoIT: Get-WmiObject win32_SystemEnclosure | select serialnumber ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jefhal Posted February 5, 2007 Share Posted February 5, 2007 And it works on a remote computer as well: Dim $pid, $ourOutput ; Open with connections to STDIN and STDOUT $pid = Run("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe Get-WmiObject -computer mycomputer win32_SystemEnclosure | select serialnumber", @SystemDir, @SW_HIDE, 3) StdinWrite($pid, @CRLF) ; Call with no string param to close STDIN StdinWrite($pid) While 1 $ourOutput &= StdoutRead($pid) If @error Then ExitLoop WEnd MsgBox(0, "", $ourOutput) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
ptrex Posted February 6, 2007 Author Share Posted February 6, 2007 @Jefhal This is a working example that needs more refining. #include <Constants.au3> $Cmd = '$colItems = get-wmiobject -class "Win32_NetworkClient" -namespace "root\CIMV2" `'&@CR& _ '-computername "." '&@CR& _ 'foreach ($objItem in $colItems)'&@CR& _ '{write-host "Caption: " $objItem.Caption'&@CR& _ 'write-host "Description: " $objItem.Description'&@CR& _ 'write-host "Installation Date: " $objItem.InstallDate'&@CR& _ '}' ; -noexit -noprofile -command help about_automatic_variables" $PowerShell = Run('PowerShell.exe -command '&$Cmd, "", @SW_HIDE , _ $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD) StdinWrite($PowerShell,@CRLF) StdinWrite($PowerShell) While 1 $line = StdoutRead($PowerShell) If @error Then ExitLoop ;If $line <> "" Then ConsoleWrite($line) ;EndIf Wend While 1 $line = StderrRead($PowerShell) If @error Then ExitLoop ConsoleWrite( "STDERR read: "& $line& @CR) Wend If you have something going post some examples in the Example Scripts section. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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