This is my first post.
I have created a macro to import any data file in Audacity as Raw Data and save it as .wav file and close the track. But i have manually told exactly what folder and file to open. But i want to add a GetFileList on top and point it to d:\temp and then it should pick from that list, one file at a time and open, convert, save and close and then do that process until all files in that folder is converted. Would love some help with these last parts. Thanks so much.
/Daniel
---------------------------
// Up here should be the GetFileList for d:\temp
Run>"C:\Program Files (x86)\Audacity2\audacity.exe"
WaitWindowOpen>Audacity
Wait>1
// Imports Raw Data File
Press ALT
Send>fir
Release ALT
Wait>2
// This should take the first file in the GetFileList and send out to open instead.
Send>d:\temp
Press Enter
Send>audio.jpg
Press Enter
WaitWindowOpen>Import Raw Data
Wait>1
Press ALT
Send>i
Press ALT
Send>few
Release ALT
WaitWindowOpen>Export Audio
Wait>1
// This should save out to the same folder of d:\temp with the same filename as imported, but with a .wav
Send>d:\temp
Press Enter
Wait>1
Send>audio.wav
Press Enter
WaitWindowOpen>Edit Metadata Tags
Wait>1
Press Enter
Wait>1
// Closes track
Press SHIFT
Send>c
Release SHIFT
---------------------------
Question about GetFileList to work..
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1414
- Joined: Sun Nov 03, 2002 3:19 am
Re: Question about GetFileList to work..
I'll see if I can walk you through how to build this in stages. We can often do this using code samples from the helpfile, and bolting them to what we have already.
Let's start with the basic sample from the GetFileList helpfile entry, and adapt it a little. We've adapted it to only look for .jpg files, and to create a new filename ready to save it as a .wav
I've added some extra notes so you can see what where we're going to add more code later.
Now we add some code before the loop, to start Audacity, as we only want to do that once.
Now we can add the code that actually does what you want to do in Audacity.
Of course I don't have Audacity to test this in, but it should get you close to where you want to go.
Let's start with the basic sample from the GetFileList helpfile entry, and adapt it a little. We've adapted it to only look for .jpg files, and to create a new filename ready to save it as a .wav
I've added some extra notes so you can see what where we're going to add more code later.
Code: Select all
//Set up your folder source and destination paths (edit this to suit your requirements)
Let>SourceFolder=d:\temp
//Start Audacity here (before the loop - we only want to start Audacity once
//##
//Get a list of *.jpg files in the source folder
GetFileList>%SourceFolder%\*.jpg,files
Separate>files,;,file_names
//Loop through and move all the files
Let>k=0
Repeat>k
Let>k=k+1
//Extract the file name from the entire path/filename
ExtractFileName>file_names_%k%,oldfilename
//Make a new filename
StringReplace>oldfilename,.jpg,.wav,newfilename
//Your PROCESSING code here
//####
Until>k,file_names_count
Code: Select all
//Set up your folder source and destination paths (edit this to suit your requirements)
Let>SourceFolder=d:\temp
//Start Audacity here (before the loop - we only want to start Audacity once
// Up here should be the GetFileList for d:\temp
Run>"C:\Program Files (x86)\Audacity2\audacity.exe"
WaitWindowOpen>Audacity
Wait>1
//Get a list of *.jpg files in the source folder
GetFileList>%SourceFolder%\*.jpg,files
Separate>files,;,file_names
//Loop through and move all the files
Let>k=0
Repeat>k
Let>k=k+1
//Extract the file name from the entire path/filename
ExtractFileName>file_names_%k%,oldfilename
//Make a new filename
StringReplace>oldfilename,.jpg,.wav,newfilename
//Your PROCESSING code here
//####
Until>k,file_names_count
Code: Select all
//Set up your folder source and destination paths (edit this to suit your requirements)
Let>SourceFolder=d:\temp
//Start Audacity here (before the loop - we only want to start Audacity once
// Up here should be the GetFileList for d:\temp
Run>"C:\Program Files (x86)\Audacity2\audacity.exe"
WaitWindowOpen>Audacity
Wait>1
//Get a list of *.jpg files in the source folder
GetFileList>%SourceFolder%\*.jpg,files
Separate>files,;,file_names
//Loop through and move all the files
Let>k=0
Repeat>k
Let>k=k+1
//Extract the file name from the entire path/filename
ExtractFileName>file_names_%k%,oldfilename
//Make a new filename
StringReplace>oldfilename,.jpg,.wav,newfilename
//Your PROCESSING code here
/////////
// Imports Raw Data File
Press ALT
Send>fir
Release ALT
Wait>2
// This should take the first file in the GetFileList and send out to open instead.
Send>d:\temp
Press Enter
Send>%oldfilename%
Press Enter
WaitWindowOpen>Import Raw Data
Wait>1
Press ALT
Send>i
Press ALT
Send>few
Release ALT
WaitWindowOpen>Export Audio
Wait>1
// This should save out to the same folder of d:\temp with the same filename as imported, but with a .wav
Send>d:\temp
Press Enter
Wait>1
Send>%newfilename%
Press Enter
WaitWindowOpen>Edit Metadata Tags
Wait>1
Press Enter
Wait>1
// Closes track
Press SHIFT
Send>c
Release SHIFT
//Let's wait a little while before we start the loop again
Wait>2
Until>k,file_names_count
Re: Question about GetFileList to work..
Thank you very much for your reply and help!
It worked great to convert the .jpg:s to wav!
I need it to be able to convert it from any filetype.
I tried by modifying the script to say *.* instead of *.jpg
But when i tries to convert another filetype i get an error in Audacity, because it wants to keep the old filetype ending. So close now.. what needs to be changed for it to be .wav for anyfiletype? Thanks. /Daniel

It worked great to convert the .jpg:s to wav!
I need it to be able to convert it from any filetype.
I tried by modifying the script to say *.* instead of *.jpg
But when i tries to convert another filetype i get an error in Audacity, because it wants to keep the old filetype ending. So close now.. what needs to be changed for it to be .wav for anyfiletype? Thanks. /Daniel

Re: Question about GetFileList to work..
I solved the last part.
I did change the *.jpg to *.* and instead of needing to send the newfilename for the .wav by saving it as a wav with the menucommand it automatically adds the .wav, so i disabled that. And added some small things. But thank you so so much for this! /Daniel
I did change the *.jpg to *.* and instead of needing to send the newfilename for the .wav by saving it as a wav with the menucommand it automatically adds the .wav, so i disabled that. And added some small things. But thank you so so much for this! /Daniel
Code: Select all
//Set up your folder source and destination paths (edit this to suit your requirements)
Let>SourceFolder=d:\temp
//Start Audacity here (before the loop - we only want to start Audacity once
// Up here should be the GetFileList for d:\temp
Run>"C:\Program Files (x86)\Audacity2\audacity.exe"
WaitWindowOpen>Audacity
SetFocus>Audacity
Wait>1
//Get a list of *.jpg files in the source folder
GetFileList>%SourceFolder%\*.*,files
Separate>files,;,file_names
//Loop through and move all the files
Let>k=0
Repeat>k
Let>k=k+1
//Extract the file name from the entire path/filename
ExtractFileName>file_names_%k%,oldfilename
//Make a new filename
StringReplace>oldfilename,*.*,.wav,newfilename
//Your PROCESSING code here
/////////
// Imports Raw Data File
Press ALT
Send>fir
Release ALT
WaitWindowOpen>Select any uncompressed audio file
Wait>1
// This should take the first file in the GetFileList and send out to open instead.
Send>d:\temp
Press Enter
Send>%oldfilename%
Wait>1
Press Enter
WaitWindowOpen>Import Raw Data
Wait>1
Press ALT
Send>i
Press ALT
Send>few
Release ALT
WaitWindowOpen>Export Audio
Wait>1
// This should save out to the same folder of d:\temp with the same filename as imported, but with a .wav
//Send>%newfilename%
Press Enter
WaitWindowOpen>Edit Metadata Tags
Wait>1
Press Enter
Wait>1
// Closes track
Press SHIFT
Send>c
Release SHIFT
//Let's wait a little while before we start the loop again
Wait>1
Until>k,file_names_count
Press ALT
Send>fx
Release ALT
Wait>1
SetFocus>Save changes to*
Press ALT
Send>n
Release ALT
MessageModal>Finished Converting Files
- Dorian (MJT support)
- Automation Wizard
- Posts: 1414
- Joined: Sun Nov 03, 2002 3:19 am
Re: Question about GetFileList to work..
It's great to see you're getting on so well with it. well done, Daniel.