czmaster Posted March 30, 2013 Share Posted March 30, 2013 Hello, I wan't to write (with consolewrite) the full content of a binary file to output it later with pipe to other app My problem is that consolewrite end after the firs NUL char. On this forum I read "the ConsoleWrite() function stops reading the string at the first NUL char" Is there a way to write the NUL (0x00) char with consolewrite (and to continue after this char) ? I can't not convert the data with binary function or replace some char because it will not work if the content change. Thank you Link to comment Share on other sites More sharing options...
water Posted March 30, 2013 Share Posted March 30, 2013 Why do you need Consolewrite and Pipe to pass it to the other program? Can't you just run the other program and pass the string using StdInWrite? 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...
czmaster Posted March 31, 2013 Author Share Posted March 31, 2013 (edited) The other app can be VLCWith VLC this command play the content of video.avi :type video.avi | vlc.exe -type video.avi write the content of the file into console (consolewrite), and with pipe vlc can read itCan I do the same with StdInWrite ?I try this code but it doesn't workLocal $foo = Run("vlc.exe -", "..\VLC\", "", $STDIN_CHILD + $STDOUT_CHILD) $f=FileOpen("video.avi") $txt=FileRead($f) StdinWrite($foo,"quit")Thank youPS ; My program will not just show a local file but if I can do that the rest Edited March 31, 2013 by czmaster Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 You need to pass the full path of VLC.EXE as parameter 1. Is "VLC" correct as working directory? I'm not sure you can pass "" as parameter 2. Try keyword Default. To make sure function Run was called successfully check the value of $foo. If it is 0 then there was an error. 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...
czmaster Posted March 31, 2013 Author Share Posted March 31, 2013 VLC run and I view its window, sorry But the stdinwrite code doesn't make a video playing. May be consolewrite and StdInWrite have the same problem (function stops reading the string at the first NUL char) Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 How about Local $foo = Run("vlc.exe -", "..\VLC\", "", $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo,"type video.avi") 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...
czmaster Posted March 31, 2013 Author Share Posted March 31, 2013 How about Local $foo = Run("vlc.exe -", "..\VLC\", "", $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo,"type video.avi") No I don't want to send a command to VLC but a binary stream (type video.avi is a Windows command line function like cat in linux) I try to to output what stdinwrite write with this code Local $foo = Run("sort.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) $f=FileOpen("video.avi") $i=0 $txt=FileRead($f) StdinWrite($foo,$txt) StdinWrite($foo) Local $data While True $data &= StdoutRead($foo) If @error Then ExitLoop Sleep(25) WEnd FileWrite(FileOpen("out.txt",2),$data) And in out.txt, I see only the char before the first NUL char, like consolewrite On the forum I see this post In any case, thank you for your help. Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 Why don't you pass the filename to VLC and let VLC process the file? 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...
czmaster Posted March 31, 2013 Author Share Posted March 31, 2013 Because I use a file just to begin and test my code If this code worked I will do the rest of my code which send stream from internet (protocol that VLC can not read) But this code doesn't work so I will not continue Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 Which protocol do you need to use? VLC can read from a lot of sources. 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...
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