Fade91

Autoit & Batch

7 posts in this topic

Hi :)

I am trying to record some audio using Linco, however for some reason it won't work!

https://romanrm.net/lineincode

 

This is my batch command that does work! (Somehow run this in Autoit :) )

linco -B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg

 

And this is how I attempted to do it in Autoit

ShellExecute("Linco.exe", "-B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg", @ScriptDir)

I even tried "Run()" and both "Run()" & "ShellExecute" seem to open the application and pass the parameters, however it fills the console (command window) with very strange letters and numbers as if i's not executing properly.

 

Thank you! :) 

Share this post


Link to post
Share on other sites



linco.exe is in @ScriptDir? No, then try:

$sLincoPath="Path to Linco Exe" ;with ending backslash
ShellExecute($sLincoPath&"Linco.exe", "-B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg")

 

1 person likes this

Share this post


Link to post
Share on other sites

I tried this but still doesn't work.

 

ShellExecute(@ScriptDir & "\Linco.exe", "-B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg")

It adds a bunch of garbage in the prompt :/

Share this post


Link to post
Share on other sites
8 minutes ago, Fade91 said:

I tried this but still doesn't work.

 

ShellExecute(@ScriptDir & "\Linco.exe", "-B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg")

It adds a bunch of garbage in the prompt :/

this "|" you have there, is a pipe, use Run( @comspec & ' /c "' & the rest . That should do it.

1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Run( @comspec & ' /c Linco.exe -B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg')

Perfect, that did it!

Just a few questions though, what is the purpose of ' /c' and what is a pipeline. How does it differ running it with @Comspec vs Run/ShellExecute.

Lots of questions but don't really know where to look for the answers :) 

Edited by Fade91

Share this post


Link to post
Share on other sites
Just now, Fade91 said:
Run( @comspec & ' /c Linco.exe -B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg')

Perfect, that did it!

Just a few questions though, what is the purpose of ' /c' and what is a pipeline. How does it differ running it with comspec vs Run/ShellExecute.

Lots of questions but don't really know where to look for the answers :) 

no clue, just my experience.

1 person likes this

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

"/c" stands for "close". Means:

Run( @comspec & ' /c

starts the DOS environment and executes the command. When finished it closes the window and exits. Try "/k" to "keep" the window. Useful when you need to debug your code.

"|" is the DOS pipe character. Means: It grabs the output of the command left of the pipe character and passes it as input to the command right of the character.

Edited by water
2 people like this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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