Jump to content

consolewrite NUL char


Recommended Posts

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

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 - 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 (NEW 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

 

Link to comment
Share on other sites

The other app can be VLC

With 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 it

Can I do the same with StdInWrite ?

I try this code but it doesn't work

Local $foo = Run("vlc.exe -", "..\VLC\", "", $STDIN_CHILD + $STDOUT_CHILD)
$f=FileOpen("video.avi")
$txt=FileRead($f)
StdinWrite($foo,"quit")

Thank you

PS ; My program will not just show a local file but if I can do that the rest

Edited by czmaster
Link to comment
Share on other sites

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...