Subject:Generic Script to process files in a folder
Posted by: _TJ
Date:1/19/2006 1:38:20 PM
This is the second post in my ongoing series of generic examples. This script contains the code to process all of the files in a folder. See my previous post <a href="http://www.sonymediasoftware.com/forums/ShowMessage.asp?MessageID=427441">Generic Script to process a bunch of files</a> for an example of how to ask the user to choose multiple files and then process the resulting list. This is intended to be a script that you can use as a starting point for your own specialized batch processors. it 1) prompts the user to select a folder 2) shows how to open files from that folder one at a time and pass them to a function for processing. (the script only opens files matching *.wav, but you can easily change it to match some other pattern instead). 4) saves the file back to the original folder after processing if processing was successful.
Message last edited on10/16/2007 2:36:38 PM by_TJ. |
Subject:RE: Generic Script to process files in a folder
Reply by: kbruff
Date:5/1/2006 5:33:21 AM
To begin scripting what should I buy Visual C++, or Visual Basic I am not sure what is the best tool to buy. Thanks, Kevin *** |
Subject:RE: Generic Script to process files in a fold
Reply by: _TJ
Date:5/3/2006 1:53:43 PM
You don't need anything other than Sound Forge. However, you may find it more convenient to work in a dedicated code editor such as Visual Studio. If you do, then you need to make DLL projects and then run them using the "Script->Run..." menu item in Sound Forge. I would personally recommend using Visual C#, but you should be able to use Visual Basic if you prefer. If you use Visual Basic, there are some gotchas mentioned by another user on this form. The default namespace for a Visual Basic project is incompatible with using that code with Sound Forge. tj |
Subject:RE: Generic Script to process files in a fold
Reply by: GPD
Date:10/16/2007 12:35:22 PM
If this:
Is changed to:
In effort to batch process a folder of AIFF files instead of Wav files, the script gives errors. I do not see anything else in the code that references .Wav. Do any other changes need to made in addition to this line to process something other than .Wav? Any ideas why this does not work? Very great script BTW. Been using it with great sucess (on Wavs)! |
Subject:RE: Generic Script to process files in a fold
Reply by: GPD
Date:10/22/2007 12:21:26 PM
Any idea why this fails with AIFF files? |
Subject:RE: Generic Script to process files in a fold
Reply by: GPD
Date:10/22/2007 4:33:02 PM
I've figured out the problem: Mac OS creates invisible files in the directory when saving over a network. (named: .filename.aif). the script tries to load these b/c they end in .aif, but it fails there b/c they are not audio files, thus stopping the processing. Solution: Manually deleete the invisible files prior to running, and the batch will run fine. ...including processing subfolders with the tip given in the other thread. I guess I could even add this to the scipt maybe, but deleting files via script makes me a bit nervous... |
Subject:RE: Generic Script to process files in a fold
Reply by: _TJ
Date:10/23/2007 3:46:52 PM
Alternatively, you could change the script so that when it fails to open a file, it just ignores the error and keeps going on. just change this
to this
|