Clutz450 Posted May 7 Share Posted May 7 Please see this conversation on Discord (https://discord.com/channels/250718998482649089/250719165227204608/1237196626293035008) and this conversation on the forums (https://forums.launchbox-app.com/topic/76605-auto-populate-rules-not-working/?do=findComment&comment=449993). But basically, I'm trying to create a playlist that only has North American Licensed Games for Nintendo Entertainment System. When I create an auto playlist for "Platform - Is Equal To - Nintendo Entertainment System", "Release Type - Is Equal To - Released", and "Region - Is Equal To - North America", I get very close to having what I want. But that playlist is also including Betas, Virtual Console, Aftermarket, etc. So I then add to my auto playlist "Version - Doesn't Contain - Beta" and all the Beta ROMs disappear. I then add "Version - Doesn't Contain - Virtual Console" and not only does it not remove Virtual Console games but the Beta games come back. From the forum post it was explained that putting the same Field in multiple lines treats each line as an AND statement and not an OR statement. So I understand why it's not working how I want it to. Also in the forum post, it was explained that if the version field was populated with semi-colons separating out each tag I could use "Version - Has None Of The Values - value1; value2; value3" and type in the tag I don't want. But because it's not, each value has to be the full string of whatever is in the version field ie "(USA) (Beta) (Aftermarket) (Unl)" and not just "(Beta). I can make this work but it's just going to be long and tedious to capture every combination of the version field with (Beta) in it. I was suggested that I might have luck posting my problem here and that maybe someone would be able to create a plugin that would help clean up the version field into something that works better with the Auto Playlists. Thank you. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted May 7 Share Posted May 7 So I think what you're trying to say is you want to convert the data in the Version field from a string to an array. a.k.a. Convert "(USA) (Beta) (Aftermarket) (Unl)" to "USA;Beta;Aftermarket;Unl" This AutoHotkey script can do that for you. myFile := %0% Loop %myFile%, 1 xmlPath = %A_LoopFileLongPath% xmlDoc := ComObjCreate("MSXML2.DOMDocument.6.0") xmlDoc.async := false xmlDoc.load(xmlPath) FileCopy, %xmlPath%, %xmlPath%.original for Game in xmlDoc.getElementsByTagName("Game") { Text := Game.getElementsByTagName("Version").item(0).text " " myString := StrReplace(Text, ") (",";") myString := StrReplace(myString, "(","") myString := StrReplace(myString, ")","") myString = %myString% Game.getElementsByTagName("Version").item(0).text := myString } xmlDoc.Save(xmlPath) Exitapp To use: Exit LaunchBox/BigBox and wait for it to completely finish it's background saves Go to /LaunchBox/Data/Platforms/ Make a copy of all the xml files and save them somewhere else (a.k.a. Backup all the files) Copy the above script into a blank text file Save the file, name it whatever you want Change the file extension from .txt to .ahk Place the file into /LaunchBox/Data/Platforms/ Drag and drop ONE of the xml files onto the AHK script This assumes you have AutoHotkey installed on your computer This will not work if you drop more than one file onto the script at one once. In fact, it might really bork things up if you do. So don't do that. It'll only take a split second to complete Move the file(s) with the file extension ".original" to somewhere else (consider it a secondary backup) Remove the script file (move it somewhere, anywhere else for future use) What it does: Loads the file you dropped onto it Copies the file you dropped onto it to theFileName.xml.original (in the same folder) Goes through all the Version elements and: replaces inner parenthesis with ; (semicolon) removes open parenthesis removes close parenthesis Save changes to the file you dropped onto it If you don't have (or don't want to have) AutoHotkey installed on your system, you can use the one that comes with LaunchBox from the Windows command prompt. Open the command prompt from within the folder in step #7. The command would be [something like]: "D:\LaunchBox\ThirdParty\AutoHotkey\AutoHotkey.exe" "myScript.ahk" "Super Nintendo Entertainment System.xml" Be sure to change the path to LaunchBox, the name of your script and the platform file you're wanting to modify. BE SURE TO USE THE QUOTES AS SHOWN. 1 1 Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 Not sure if you saw my message in Discord, but here is an error I am getting when trying to use the ahk file you had me create. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted May 10 Share Posted May 10 31 minutes ago, Clutz450 said: Not sure if you saw my message in Discord, but here is an error I am getting when trying to use the ahk file you had me create. You'll get that error if you don't do step #8. Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 But I was dragging and dropping the xml onto the ahk file. Not sure why it's not working then. I'll try using it from command prompt and see if it works that way. 1 Quote Link to comment Share on other sites More sharing options...
ci2own Posted May 10 Share Posted May 10 On 5/7/2024 at 4:00 AM, Clutz450 said: Please see this conversation on Discord (https://discord.com/channels/250718998482649089/250719165227204608/1237196626293035008) and this conversation on the forums (https://forums.launchbox-app.com/topic/76605-auto-populate-rules-not-working/?do=findComment&comment=449993). But basically, I'm trying to create a playlist that only has North American Licensed Games for Nintendo Entertainment System. When I create an auto playlist for "Platform - Is Equal To - Nintendo Entertainment System", "Release Type - Is Equal To - Released", and "Region - Is Equal To - North America", I get very close to having what I want. But that playlist is also including Betas, Virtual Console, Aftermarket, etc. So I then add to my auto playlist "Version - Doesn't Contain - Beta" and all the Beta ROMs disappear. I then add "Version - Doesn't Contain - Virtual Console" and not only does it not remove Virtual Console games but the Beta games come back. From the forum post it was explained that putting the same Field in multiple lines treats each line as an AND statement and not an OR statement. So I understand why it's not working how I want it to. Also in the forum post, it was explained that if the version field was populated with semi-colons separating out each tag I could use "Version - Has None Of The Values - value1; value2; value3" and type in the tag I don't want. But because it's not, each value has to be the full string of whatever is in the version field ie "(USA) (Beta) (Aftermarket) (Unl)" and not just "(Beta). I can make this work but it's just going to be long and tedious to capture every combination of the version field with (Beta) in it. I was suggested that I might have luck posting my problem here and that maybe someone would be able to create a plugin that would help clean up the version field into something that works better with the Auto Playlists. Thank you. If not wrong, what you want it to sort all officially released games, and exclude the rest. I achieve this, by using Retool + RomVault programs. With Retool you can split a complete .dat file into a new .dat file but filtering by region, language, etc. With RomVault you use the splitted file to sort the complete romset. Let me know if need help with that programs. Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 12 minutes ago, ci2own said: If not wrong, what you want it to sort all officially released games, and exclude the rest. I achieve this, by using Retool + RomVault programs. With Retool you can split a complete .dat file into a new .dat file but filtering by region, language, etc. With RomVault you use the splitted file to sort the complete romset. Let me know if need help with that programs. Thanks for the suggestion. I already use RomVault and I tried using RomVault to do what you suggest but it just made maintaining my romsets more involved. Since I learned about Auto Playlists, I've for the most part be able to achieve what I want. Once I get the version field thing straightened out, then I should have everything exactly how I want it. Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 53 minutes ago, JoeViking245 said: You'll get that error if you don't do step #8. It worked using command prompt. Still not sure why dragging and dropping didn't work, but oh well. Thank you so much for your time and helping me out with this. Now to see if this truly is going to be the solution I was looking for to help me with Auto Playlists. 1 Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 @JoeViking245 What if I wanted to keep the parenthesis? Like have it "(USA); (Rev 1); (Aftermarket)" instead of "USA; Rev 1; Aftermarket". Would I just have to delete these 2 lines? myString := StrReplace(myString, "(","") myString := StrReplace(myString, ")","") Withhout the parenthesis, the first version tag looks like it could be part of the title. It's more noticable when there is only 1 tag. For example, 3-D World Runner looks like 3-D World Runner USA as if the USA is part of the title. I know I can turn off showing the versions but I kinda like it. Thank you. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted May 10 Share Posted May 10 15 minutes ago, Clutz450 said: It worked using command prompt. Still not sure why dragging and dropping didn't work, but oh well. Thank you so much for your time and helping me out with this. Now to see if this truly is going to be the solution I was looking for to help me with Auto Playlists. It may be a matter of when you installed AHK v2.0 and then installed v1.x, there may have been some overlapped files that didn't change. So it may be using parts from v1 and v2. A complete uninstall of v2 and a complete uninstall of v1 (and maybe a reboot of the PC), then reinstall v1 may fix it. Just a guess though. Since you know it works from the command line using LaunchBox's AutoHotkey.exe, you could create yet another file to call the 1st file. Create a batch file that you can drag & drop the file onto it. Put the batch file and the AHK script in the same folder as your xml files [that you had already made a backup of ]. @echo off "D:\LaunchBox\ThirdParty\AutoHotkey\AutoHotkey.exe" "MyScript.ahk" %1% Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted May 10 Share Posted May 10 (edited) 9 minutes ago, Clutz450 said: What if I wanted to keep the parenthesis? Like have it "(USA); (Rev 1); (Aftermarket)" instead of "USA; Rev 1; Aftermarket". Would I just have to delete these 2 lines? Remove those 2 lines. Then in the previous line where you're replacing ") (" with "; " add the parens back in. myString := StrReplace(Text, ") (","); (") aka: Replace [close parenthesis][Space][open parenthesis] with [close parenthesis][semi colon][Space][open parenthesis] Edited May 10 by JoeViking245 fixed nomenclature Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 4 minutes ago, JoeViking245 said: Since you know it works from the command line using LaunchBox's AutoHotkey.exe, you could create yet another file to call the 1st file. That's the funny thing. I didn't use the one in LaunchBox. I just "cd" into my Platform folder and run my ahk file from there like this. But I will try Uninstalling and reinstalling and restarting my computer like you suggested. And thanks for the batch script idea. That may come in handy. Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 That looks so much better. Thank you again for your help. If I may make a suggestion, I think this is the default way that LaunchBox should be filling in the Version Field. Not sure how much pull you have with the development. I'll be sure to suggest this in the Feature Request area as well once I get all my playlists set up how I want them and confirm that this does in fact do what I wanted it to do. 1 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted May 10 Share Posted May 10 32 minutes ago, Clutz450 said: That looks so much better. Thank you again for your help. You're welcome. Glad I was able to help. Hopefully in the end, it gives you what you're after. 33 minutes ago, Clutz450 said: If I may make a suggestion, I think this is the default way that LaunchBox should be filling in the Version Field. Not sure how much pull you have with the development. I have the exact same amount of pull with the LaunchBox Development staff as you do. The only difference between us is, as a volunteer, I get to have red letters under my avatar. 😎 When you go to make your feature request, verify there isn't the same-ish one already. And if there is, be sure to upvote it. So you know, I've looked into this in the past (the plugin idea) and quickly abandoned the idea. What I found (at the time I looked into it) was there were a lot of inconsistencies in how the "versions" were appended to the file names. (Some, were, in, parenthesis). [Some, in, brackets]. [Some] (were, mixed). etc. It may have been simply a source issue too (where the DATs came from, who wrote the DAT, what format they felt like following that day....). Maybe "today", a more consistent nomenclature is being followed. But personally, I don't use no-intro sets. So don't really care. No offense. Regarding "the default way that LaunchBox should be filling in the Version Field", you need to keep in mind, they can only work with what they're given. "Crap in, crap out." "You can't fix stupid." And any other old adage that "fits the bill". 1 Quote Link to comment Share on other sites More sharing options...
Clutz450 Posted May 10 Author Share Posted May 10 No offense taken. And I hope I didn't offend saying how I thought the default way should be. I was just saying that assuming that once I had this set up that things would work the way I wanted. But I'm sure you saw from my post on the Discord that it didn't. lol. I agree with everything you said about the versioning. But at the same time, I can't really complain either when a bunch of volunteers are spending their free time doing what they feel is best. At the end of the day, I know what I want to achieve and know how to accomplish it as things currently are. I'm just trying to find ways to make it easier for myself and hopefully others that are trying to do the same thing. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.