Jump to content
LaunchBox Community Forums

Script to copy info from platform XML to new text file


masterfulmethods

Recommended Posts

This is probably a long shot. Not sure if this would even be possible but I thought i'd throw it out there, see if someone with scripting knowledge could help me out.

I have well over 1000 rom hacks across different systems, and i've made separate platforms for each system with rom hacks. Each platform has an XML file in LaunchBox\Data\Platforms and I'd like to figure out if there is a way to create a new text file named from part of the <ApplicationPath> tag, then copy the <Notes> tag to the associated file.

Example: Create Legend of Zelda [ROMHACK] (Triforce Power) (v3.6).txt from <ApplicationPath>Games\Nintendo Entertainment System (Hacks)\Legend of Zelda [ROMHACK] (Triforce Power) (v3.6).zip</ApplicationPath> , then take everything between the <Notes></Notes> tags and copy that into the associated text file

Hopefully that makes sense. Obviously, if it would need to take everything between the tags, rather than just a section, I could deal with that (if the system can deal with the backslashes or create a directory structure matching the full path between the tag)

Also interested in doing the reverse, finding the rom name based on the text file name, then just copying the contents of the text file into the <Notes> tag for the associated game in the XML file

Link to comment
Share on other sites

Parsing (extracting) the xml's into text files ain't so bad. But reversing that takes a little bit more (.... than I'd want to do).  I assume all your rom names are the full title as in your example vs like Arcade (MAME) where the roms name is shortened ("bbredux.zip" --> "Bubble Bobble ('bootleg redux' hack for Bobble Bobble PCB)").

Are you only wanting games that only have "ROMHACK" in the application path.  Or all games in a given platform (xml file)?  And then one text file per game parsed?  So like well over 1000 text files?

Link to comment
Share on other sites

Quote

Parsing (extracting) the xml's into text files ain't so bad. But reversing that takes a little bit more (.... than I'd want to do)

I was just thinking the reverse would be nice if something ever happened to LaunchBox or if I wanted to start over, because otherwise it's right-click > edit > notes >enter description for every single romhack.

Quote

 I assume all your rom names are the full title as in your example vs like Arcade (MAME) where the roms name is shortened

Yeah the roms all have a full title like the example; I standardized on a naming convention for the romhacks, so they all have [ROMHACK] in the title/application path.

Quote

Are you only wanting games that only have "ROMHACK" in the application path.  Or all games in a given platform (xml file)?

Yeah only games that have [ROMHACK], which will also be all games in a given platform because I have each console's romhacks in a separate platform

Quote

And then one text file per game parsed?  So like well over 1000 text files?

I was thinking separate files, yeah, but I guess I'm not opposed to other ideas. Are you thinking like all games in a platform to it's own file, so there's just 1 new file per platform?

Link to comment
Share on other sites

3 minutes ago, masterfulmethods said:

if something ever happened to LaunchBox

LaunchBox makes automatic backups of your entire "Data" folder.   ../LaunchBox/Backup

5 minutes ago, masterfulmethods said:

I was thinking separate files

Either way is simple enough.  Depends on what you want to do with them.

All in all, @dragon57 should have enough info to whip up something that suites your needs. ;) Send him a PM.  (Thanks D! :D)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...