Jump to content
Fade91

Autoit & Batch

Recommended Posts

Fade91

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
AutoBert

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")

 

  • Like 1

Share this post


Link to post
Share on other sites
Fade91

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
argumentum
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.

  • Like 1

Share this post


Link to post
Share on other sites
Fade91
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
argumentum
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.

  • Like 1

Share this post


Link to post
Share on other sites
water

"/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
  • Like 2

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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

×