It is currently 24 Jul 2017, 06:29
   
Text Size

Important 3 Letter MTG/MWS Set Codes Overhaul Poll: Vote Now

Discuss anything concerning this site and its contents

Moderator: CCGHQ Admins

Do You Support a Change to 3 Letter Set Codes?

Yes
54
96%
No
2
4%
 
Total votes : 56

Re: Important 3 Letter MTG/MWS Set Codes Overhaul Poll: Vote

Postby ParkerLewis » 01 Nov 2016, 10:52

Great.

The two following solutions require a list of all set names to change in a set_names.txt file with the following format :

Old name/New name
Code: Select all
A/LEA
ON/ONS
TE/TMP
(This is my current set_names.txt test file, and it worked great). If you could just provide this list, then the problem is solved.

To auto-rename directories

Just create a .txt file, open it with Notepad, and input this :

Code: Select all
set picsdir=D:\Example\Magic Workstation\Pics
for /f "tokens=1,2 delims=/" %%i in (set_names.txt) do if exist "%picsdir%\%%i" (move "%picsdir%\%%i" "%picsdir%\%%j")
OF COURSE, you have to edit the relevant path to your MWS Pics dir according to your MWS setup, the path here is just an example.

Save and rename it as "folder_rename.bat". Then just run it by double-clicking on it. Work done, all your set directories are correctly renamed.

To auto-update .mwDeck files

There is no real way to mess this up either, but just in case, please make a copy of your Decks folder somewhere.

To batch replace set codes inside .mwDeck files, https://findandreplace.codeplex.com/ will help us do the job. Just get the program first and put it anywhere you like (it's a simple fnr.exe, no install, no nothing). You can open it if you want but that's not going to be needed.

Now that you have your fnr.exe, create a .txt file, open it with Notepad, and input this :

Code: Select all
set fnrexe=C:\FNR\fnr.exe
set decksdir=D:\Magic Workstation\Decks
for /f "tokens=1,2 delims=/" %%i in (set_names.txt) do ("%fnrexe%" --cl --dir "%decksdir%" --fileMask "*.mwDeck" --includeSubDirectories --find "[%%i]" --replace "[%%j]")
OF COURSE, you have to edit the two relevant paths to fnr.exe and your MWS Decks dir according to your setup, the two paths here are just an example.

Save and rename it as "deck_update.bat". Then just run it by double-clicking on it. Work done, all your .mwDeck files are updated.

Both at the same time

Of course, you can also just make one .bat file to do both :

Code: Select all
@REM This code can be run from anywhere. Requirements :

@REM 1) Have a list of all set names to change in a set_names.txt file in the same directory.
@REM    This set_names.txt file should have 1 line per set name. The expected syntax for these lines is this : oldname/newname
@REM 2) Have fnr.exe somewhere on your computer (downloadable from findandreplace.codeplex.com). This is a simple .exe, no install required.
@REM 3) You have to edit fields below to input the location of a) your MWS Pics directory, b) your fnr.exe, and c) your MWS Decks directory.

@REM Once this is done, just save & close the file (make sure it is still a .bat), then run it by double-clicking on it or via a command window. That's it :)

@REM Update pictures set folders names with new name convention
set picsdir=D:\Example\Magic Workstation\Pics
for /f "tokens=1,2 delims=/" %%i in (set_names.txt) do if exist "%picsdir%\%%i" (move "%picsdir%\%%i" "%picsdir%\%%j")

@REM Update deck files with new name convention
set fnrexe=C:\FNR\fnr.exe
set decksdir=D:\Magic Workstation\Decks
for /f "tokens=1,2 delims=/" %%i in (set_names.txt) do ("%fnrexe%" --cl --dir "%decksdir%" --fileMask "*.mwDeck" --includeSubDirectories --find "[%%i]" --replace "[%%j]")
ParkerLewis
 
Posts: 8
Joined: 30 Oct 2016, 22:28
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form