Sign in to follow this  
Followers 0
BabaG

complete noob questions

6 posts in this topic

i have a task that's getting to be kind of late and have just found autoit.

could really use a few pointers to get me going quickly. i'm anything but

a programmer so...

i have a large number of separate video files and audio files that need

to be 'muxed' (combined) into single files containing both video and

audio. i have the app to do it but it does not batch process so i need to

find a way of automating the process with a script or macro. the process

i have in mind is basically,

open the app

open the directory with the video

open the directory with the audio

navigate to video file input field

copy the first video file's name to the video file input field in the app

navigate to audio file input field

copy the first audio file's name to the audio file input field in the app

navigate to output filename field

apply a filename (based on video filename, just different extension)

navigate to begin processing

wait for processing to finish

repeat above with second file in directories

exit app when last file processed

i'm reading the documentation but it's a lot to go through from scratch

and i was hoping an experienced user could help get me going as my

tasks are quite specific. if i can get this going it will likely get me a long

way towards getting the understanding i need to use autoit more

generally as this is the type of thing i would use it for.

thanks,

BabaG

Share this post


Link to post
Share on other sites



Being a noob myself I thought I'd try to help you out...

What you want to do should definitely be possible, the only thing I can't think of how to do is wait for the process to stop(I'm sure its not that hard I just don't have experience with it)

What you want to focus on almost entirely is ControlSend. That can send keyboard or mouse clicks to various buttons and whatnot.

It can be a little daunting at first but before you know it you'll get the hang of it. Look in the help file under Winzip Installation. That covers a lot of what you want. Also use the Autoit Window info tool to figure out the needed parameters of controlsend. If you need more help let us know, but see if you can come up with a little starter script or something, something small( I found making a script to install winrar good for practice)

Good luck

Andrew


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thanks andrew. will look into that. controlsend sounds good.

before i can use it, though, i need filenames.

how do i read a directory's contents (filenames) into an array?

all the things i've seen as functions seem to refer to finding

things based on known filenames that are coded into the script.

what i need to do is step through a directory, grabbing the

filenames, and inputing them into my app. maybe best way to

do this is by finding *.m2v files and reading the names into

an array. then a simple loop could call them one at a time.

but how to do this? all the functions i've seen that seem file

related seem to want the input of known filenames.

thanks again,

BabaG

Edited by BabaG

Share this post


Link to post
Share on other sites

Here is a script that I nabbed out of the help file that shows you how to grab all the file names in a directory. Hope it helps.

; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile("*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

open the app Run() or RunWait()

open the directory with the video Use controls and the Control* commands

open the directory with the audio Same as above

navigate to video file input field Same as above

copy the first video file's name to the video file input field in the app Same as above, also pass a file search into an array

navigate to audio file input field Use controls and the Control* commands

copy the first audio file's name to the audio file input field in the app Use controls and the Control* commands

navigate to output filename field Use controls and the Control* commands

apply a filename (based on video filename, just different extension) Use controls and the Control* commands

navigate to begin processing Use controls and the Control* commands

wait for processing to finish WinWaitNotActive()

repeat above with second file in directories Do the whole thing in a For, Do, or While loop

exit app when last file processed WinClose()

Use a file search like the one ishmael provided, or browse the forums for "file search" for other alternatives. http://www.autoitscript.com/forum/index.ph...st&p=261201 might be applicable.

Once you have the list of files in an array:

For $i = 1 to $arrayname[0]     ; $arrayname[0] is the number of objects in the array
;do all your required stuff
Next

Good luck.

Edited by mikehunt114

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

If you have downloaded the full version of SciTe, there is a macro recorder that will pretty much what you need. You will need to test the code it writes for you after you record what you want to automate. It works pretty well, and it has really saved me time in scripting stuff. Enjoy using AutoIt, and welcome to the Forums!

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  
Followers 0