Skip to content

Instantly share code, notes, and snippets.

@willwade
Last active February 17, 2025 14:14
Show Gist options
  • Save willwade/26a1327c4e130b6afa36977fc129e09b to your computer and use it in GitHub Desktop.
Save willwade/26a1327c4e130b6afa36977fc129e09b to your computer and use it in GitHub Desktop.
Make installing elevenlabs button with bridgingvoice easier. youll need https://github.com/willwade/AACProcessors
To use

1. Install python 
2. open a cmd line 
3. run pip install aacprocessors
4. Copy and paste this text below into a notepad file. Edit your xml as you wish. 
5. run it like python replaceSpeakButtonGridset.py 
import argparse
import os
from aac_processors.gridset_processor import GridsetProcessor
def main():
parser = argparse.ArgumentParser(
description="Replace cell content in a Gridset file."
)
parser.add_argument("gridset_path", help="Path to the original gridset file.")
parser.add_argument(
"elevenlabs_voice_id", help="New voice ID to replace %VOICEID%."
)
args = parser.parse_args()
new_content_xml = f"""
<Content>
<Commands>
<Command ID="Action.Copy" />
<Command ID="ComputerControl.Run">
<Parameter Key="FileName">C:\\Program Files (x86)\\Bridging Voice\\Eleven Labs.exe</Parameter>
<Parameter Key="AllowSwitchTo">1</Parameter>
<Parameter Key="Arguments">{args.elevenlabs_voice_id}</Parameter>
<Parameter Key="RunCommandType">Program</Parameter>
</Command>
</Commands>
<CaptionAndImage>
<Caption><![CDATA[ ]]></Caption>
<AudioDescription>speak</AudioDescription>
<Image>[GRID3X]speak_all.wmf</Image>
</CaptionAndImage>
<Style>
<BasedOnStyle>Workspace</BasedOnStyle>
<FontSize>12</FontSize>
</Style>
</Content>
"""
# Define the output path
base_name = os.path.splitext(args.gridset_path)[0]
output_path = f"{base_name}_modified.gridset"
processor = GridsetProcessor()
processor.replace_cell_with_xml(
gridset_path=args.gridset_path,
target_caption=None,
target_action="Action.Speak",
new_content_xml=new_content_xml,
output_path=output_path,
)
print(f"Modified gridset saved to: {output_path}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment