Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Help: Convert to upper or lower case in Batch file  (Read 15527 times)

0 Members and 1 Guest are viewing this topic.

wj2k3

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 122
  • Last login:August 22, 2006, 12:23:48 am
  • Not!
Help: Convert to upper or lower case in Batch file
« on: February 07, 2005, 04:52:29 pm »
Anybody have any ideas on how to convert a variable from lower case to upper case (or vice versa) in a Batch file. 

My problem is that Minwah's Mamewah sends an Upper case rom name and I am trying to match it in a list created by Buddabing's ListGen utility which is lower case. (and then launch his Movie Maker from within Mamewah)

Have searched and Googled and have't come up with a solution yet, other than learn a real programming language.  (might have to dive into that)

thanks for any help...

Buddabing

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1845
  • Last login:February 12, 2015, 02:51:45 pm
  • I'm a llama!
Re: Help: Convert to upper or lower case in Batch file
« Reply #1 on: February 07, 2005, 05:51:11 pm »
Anybody have any ideas on how to convert a variable from lower case to upper case (or vice versa) in a Batch file.
I have changed my nickname to "Cakemeister". Please do not PM the Buddabing account because I do not check it anymore.

Please read the wiki!

wj2k3

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 122
  • Last login:August 22, 2006, 12:23:48 am
  • Not!
Re: Help: Convert to upper or lower case in Batch file
« Reply #2 on: February 07, 2005, 06:17:50 pm »
I didn't want to create movies for every single game in my filtered list (atleast not yet ;)).  It takes quite awhile.  Specially when I don't seem to have my filter.SQL file set up 100% correct.  I still get games that require me to enter 'ok'.  So my computer patiently waits for me to get home from work or to wake up from my slumber (or both ::)) and enter 'ok'. 

Also, it will be easier to me to update problem movies by using the latest and greatest  SSF files and re-run the production of just a few movies as I come across them.

I just created a Batch file that read the Makemovie.bat and outputed a file with a bunch of if statements.  But the if statements require both paramaters to be in the same case.

If you could easily add an -uppercaseromname option, that would be awesome. 

Keep up the great work. :)

papaschtroumpf

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 972
  • Last login:July 23, 2013, 11:41:10 pm
  • Have a Cow!
Re: Help: Convert to upper or lower case in Batch file
« Reply #3 on: February 07, 2005, 06:23:24 pm »
There used to be an old trick to force an argument to upper case: the DOS PATH command would alwyas convert to upper case, so you could do:

@ECHO OFF
SET _MYTMP=%PATH%
PATH %1
ECHO %PATH%
PATH %_TMP%
SET _MYTMP=

save it to upper.bat and then you can do:

C:>upper.bat testing
TESTING
C:>


Haven't tried it in years so not sure it still works under a windows dos box.
Seem a little too complicated for what you need though.

Do you have a text editor, or excel, or something that you coud import the file into and change through a function of that editor?

wj2k3

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 122
  • Last login:August 22, 2006, 12:23:48 am
  • Not!
Re: Help: Convert to upper or lower case in Batch file
« Reply #4 on: February 07, 2005, 07:04:17 pm »
Thanks for the suggestion Papaschtroumpf.  I tried that trick but it didn't work.  I don't think that Path converts to upper case anymore.  When I just type "path" to display what it is currently set to,  the path(s) that are displayed have both upper and lower case letters.

I wish it was that easy because I could easily add it to my batch  file but alas, no luck.

Buddabing

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 1845
  • Last login:February 12, 2015, 02:51:45 pm
  • I'm a llama!
Re: Help: Convert to upper or lower case in Batch file
« Reply #5 on: February 08, 2005, 10:25:16 am »
Okay, I've added two options to ListGen:

-force_uppercase_romnames
-force_lowercase_romnames

or, in listgen.ini:
force_uppercase_romnames 1
force_lowercase_romnames 1

The defaults for these options is zero. Forcing lowercase always overrides forcing uppercase if both options are on.

The functions of these options should be fairly obvious :)

I've uploaded a new executable, get it here.

Regards,
Buddabing
I have changed my nickname to "Cakemeister". Please do not PM the Buddabing account because I do not check it anymore.

Please read the wiki!

lucindrea

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 262
  • Last login:July 28, 2005, 10:06:19 am
  • I dont think I'm a llama!
Re: Help: Convert to upper or lower case in Batch file
« Reply #6 on: February 15, 2005, 02:49:29 pm »
well you did mention that it would require codeing , and i think you allready have your soultion , but i figured i would toss this on here anyway as i use it all the time .. it's perl ,  just add/remove the # on the line you want the function for , inputfile is a.txt output is b.txt

$file = "a.txt";
$file2 = "b.txt";
open(IN, "<$file" ) || die "Cannot read file $file\n";
open(OUT, ">$file2") || die "Cannot read file $file2\n";
while (<IN>) {
   tr/A-Z/a-z/; # convert to lower case
   #tr/a-z/A-Z/; # convert to upper case
   print OUT;
}
close IN;
close OUT;