Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Need some VBS help


Recommended Posts

Posted

I can't figure out why I am struggling with this so much but it is time to ask for help. :)

I want to write a simple VBS that will do two things in a loop:

- Write the romname ("name") into a variable

- Write the emulator ("EMU") into a varible

So, I'll use a sample HS XML as an example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--Generated by Don's HyperSpin Tools version 4.2.6-->

<!--MAME-->
<menu>
 <game image="'" index="true" name="[color="#FF0000"]88games[/color]">
   <description>'88 Games</description>
   <cloneof />
   <crc />
   <manufacturer>Konami</manufacturer>
   <year>1988</year>
   <genre>Sports/Track & Field</genre>
   <rating>AAMA - Green (Suitable For All Ages)</rating>
   <EMU>[color="#FF0000"]MAME[/color]</EMU>
<enabled>Yes</enabled>
 </game>
 <game image="0" index="true" name="[color="#FF0000"]005[/color]">
   <description>005</description>
   <cloneof />
   <crc />
   <manufacturer>Sega</manufacturer>
   <year>1981</year>
   <genre>Maze</genre>
   <rating>AAMA - Green (Suitable For All Ages)</rating>
<EMU>[color="#FF0000"]MAME[/color]</EMU>
<enabled>Yes</enabled>
 </game>
</menu>

In the example above, I would like to write the "name" (88games) into a variable and write "EMU" (MAME) into another variable. I then would do want I want with those two variables and then loop through for the next game (005/MAME).

John

hsac.png

"There are some who call me.......Tim."

Posted

Stay tuned...I worked it out.

If anyone is curious, here is what I am doing...

I am one of those that have mutiple emulators (MAME, TTX, Daphne, Sega Model 2, etc) setup on a single wheel. I prefer to leave HyperSync the way it is was meant to be used (syncing systems one-to-one as normal rather than associating multipe systems with a single wheel). That way you do not run into an issue with common romnames across multiple platforms stepping on each other (i.e. "ace" is both a MAME and Daphne romname)

So...I am writing a vbscript that will be used to copy artwork the appropriate artwork\videos from the true emulator media folder (\hyperspin\media\mame\images\wheel) to my custom wheel media folder (\hyperspin\media\My Arcade\images\wheel). The logic of the VBS is such: it will get e "name" atrribute value and a "<EMU>" node value (that I added for each entry) so it knows where to pull the media files from (i.e. name=goldnaxe and EMU=MAME). If the media file already exists in the destination folder...it does nothing. If the media file does not exist in the source location...it does nothing.

I'm hoping all of this will become unnecessary with HB Live but I guess we'll see. :)

John

hsac.png

"There are some who call me.......Tim."

Posted

Hi Jonodon....can can easily parse out the necessary info using split, replace, and maybe regex. Example....store the entire xml into an array variable where each line would be an array element. Then use readline to call that line (use some verification that you have the correct line by using some regex queries) and use the split method using a "[space]. When u store ur split into into a variable, that variable becomes an array of substrings. Use a loop to grab a specific array element (at this point, the substring should contain game="[game title]")....now we just need to strip the name=".....use the replace method to replace name=" with nothing and use another replace to strip your " with nothing....and voilà! Let me know if u need any help understanding this process

[sIGPIC][/sIGPIC]
Sega Saturn Japanese Wheel Project: COMPLETE!! If you have FTP access, find my name and grab the set now!!!

Posted

Ah looks like u may have it sorted out...didnt read your last post...let me know if you need any additional insight as im pretty fluent in vb and java

[sIGPIC][/sIGPIC]
Sega Saturn Japanese Wheel Project: COMPLETE!! If you have FTP access, find my name and grab the set now!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...