fix_speakercodes script
This script (fix_speakercodes.rb) automates the replacement of incorrectly coded speakers with a different code (e.g. all instances of MOT can be changed to FAT) within an .opf.
Last updated
This script (fix_speakercodes.rb) automates the replacement of incorrectly coded speakers with a different code (e.g. all instances of MOT can be changed to FAT) within an .opf.
Last updated
This script (fix_speakercodes.rb) automates the replacement of incorrectly coded speakers with a different code (e.g. all instances of MOT can be changed to FAT) within an .opf.
In order to use this script, you will need to pull a local copy of the specific .opf file you are working on AND a local copy of the script (this will help avoid any issues if more than one person is running the script at a time). Make sure to create these separate copies to avoid overwriting the originals, especially if an error is made. We always want to have a backup!
Create a copy of the .opf that you want to fix in Working Files.
Open the .opf in DataVyu.
Check that the column header in the .opf file is labeled_object. If it is not, rename the header by double-clicking the region highlighted below.
Open the script ''fix_speakercodes.rb'' in any word editor (like Atom) that is available on your machine
The script lives in the following directory: /Volumes/seedlings/Scripts_and_Apps/fix_speakercodes.rb
You will need to make a few manual edits before you can run the script.
Replace "YYY" (in yellow) with the current speaker code that was incorrectly coded in the file
Replace "XXX" (in yellow) with the correct speaker codeExample: MOT is coded incorrectly and should be changed to FAT; so MOT will be our "YYY" and FAT will be our "XXX".
Save the file.
Run the script in DataVyu (you should already have your .opf open) by going to Script -> Run Script and navigating to the .rb file you just edited.
Check in the .opf that everything worked successfully and the speaker codes were properly edited.
Replace the old .opf with your newly edited one and delete the working files version.