Jump to content
Sign in to follow this  
AtlantTT

Hi Gurus Some help needed File search and processing

Recommended Posts

AtlantTT

So i have got :

1)Folder with incomming files (C:in)

example :

aaa.m2v

aaa_R.wav

aaa_L.wav

aaa_M.wav

Before i recive files in this Folder i dont know exact names ,but structure is same ****.m2v and ****_L.wav

After files recived it need to be sent to convert tool

2)video convert tool

works in cmd by atribbutes

example :

coder.exe C:Inaaa.m2v C:Outputaaa.lxf -wav0:D:Inaaa_L.wav -wav1:D:Inaaa_R.wav -format:0 -drop:0

After converter end it task it stops in CMD with words Wrap Complete and waits for input(Enter key) then takes next file .

My Solution

1 txt files (File listing)

1 bat script (takes txt file 1 line by one and send to coder.exe)

1 Autoit Script (starts Cmd and sends in loop Enter key)

Main Problem is in sorting files

I need some logics like

Step 1 Dir files in dir

Step 2 if in folder there is :

aaa.m2v and aaa_L.wav and aaa_R.wav then do this in cmd

coder.exe C:Inaaa.m2v C:Outputaaa.lxf -wav0:D:Inaaa_L.wav -wav1:D:Inaaa_R.wav -format:0 -drop:0

if aaa.m2v , aaa_M.wav then do this in cmd

coder.exe C:Inaaa.m2v C:Outputaaa.lxf -wav0:D:Inaaa_M.wav -wav1:D:Inaaa_M.wav -format:0 -drop:0

Auto it

#include <Process.au3>

$pr = "c:scriptsmono.bat"

_RunDOS("start " & $pr )

$a = 1

While $a =1

WinWaitNotActive("Administrator: mono","",15)

Sleep(15000)

ControlSend("Administrator: mono","","","{ENTER}")

Sleep(15000)

WEnd

mono.bat

@echo off

title mono

@echo on

for /f %%i in (c:scriptsmono.txt) do @start C:Program Files (x86)CoderCoder.exe D:Inmedia.dirmon%%i.m2v C:Output%%i.lxf -wav0:C:In%%iM.wav -wav1:C:In%%iM.wav -format:0 -drop:0

for Stereo changing is only TITLe and wav0:aaa_L.wav and wav1:aaa_R.wav

Maybe anybody can help me to automize it better ?

can pay (paypal) 2-5 $

Edited by AtlantTT

Share this post


Link to post
Share on other sites
HeavenlyDemon

You can use this to list all the files in the folder (number of files and full filename + extansion)

#include <File.au3>

$path = @ScriptDir & "\workdir\" ; path to where the files are

$files = _FileListToArray($path)
For $i = 1 To $files[0] ; $file[0] >>>> the total number of files in the directory

MsgBox(0, $files[$i], $files[$i])
Next

Read in help document _FileListToArray

Edited by HeavenlyDemon

Share this post


Link to post
Share on other sites
AtlantTT

Ok But what about

comparing and logics

so we writed to array :

1111.m2v

1111_R.wav

1111_L.wav

2222.m2v

2222_M.wav

So IF 1111.m2v got L.wav and R.wav then

do in cmd

coder.exe C:In1111.m2v C:Output1111.lxf -wav0:D:In1111_L.wav -wav1:D:In1111_R.wav -format:0 -drop:0

And if only M.wav then cmd

coder.exe C:In2222.m2v C:Output2222.lxf -wav0:D:In2222_M.wav -wav1:D:In2222_M.wav -format:0 -drop:0

skype : pur4ik If needed

You can use this to list all the files in the folder (number of files and full filename + extansion)

#include <File.au3>

$path = @ScriptDir & "\workdir\" ; path to where the files are

$files = _FileListToArray($path)
For $i = 1 To $files[0] ; $file[0] >>>> the total number of files in the directory

MsgBox(0, $files[$i], $files[$i])
Next

Read in help document _FileListToArray

Share this post


Link to post
Share on other sites
JLogan3o13

AtlantTT, try looking at StringInStr in the help file. Building on HeavenlyDemon's suggestion, you could do something like this:

#include <File.au3>

$path = <path to directory>
$files = _FileListToArray($path)

   For $i = 1 To $files[0]
      If StringInStr($files[$i], "_L") Then
    ;Command for _L files
   ElseIf StringInStr($files[$i], "_R") Then
    ;Command for _R files
   Else
    ;Default Command
   EndIf
  Next

You may need to tweak it to meet your needs, but that should get you pointed in the right direction.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

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
Sign in to follow this  

×