Converting *.prs files to xml automaticaly

Post Reply
User avatar
magmavander
Posts: 714
Joined: Tue Nov 22, 2011 5:22 pm
Location: France
Contact:

Converting *.prs files to xml automaticaly

Post by magmavander »

Is this possible ? Sorry if it have been asked before...
User avatar
IXix
Posts: 1141
Joined: Wed Nov 23, 2011 3:24 pm

Re: Converting *.prs files to xml automaticaly

Post by IXix »

I don't thinks so. The prs files don't store any info about the parameters (name, data type etc.) so all you have is some binary data that could be interpreted in various ways.

If you could load a machine dll and query it about what its parameters are, then translating the prs file into xml format would be fairly easy. I don't know how hard it would be to do the machine loading bit though.
User avatar
magmavander
Posts: 714
Joined: Tue Nov 22, 2011 5:22 pm
Location: France
Contact:

Re: Converting *.prs files to xml automaticaly

Post by magmavander »

Thanks IXix :)

I have tons of presets (I mean prs files).

Another thing I'd like to do is to find a software that can check all these prs files and finding those which share the same presets with a different name to erase them.
By example I have a lot of Infector prs files that are named like that : Infector.prs, Infector2.prs, Infector3.prs, Infector4.prs...
Some of them share exacly the same presets, some are different.
I have downloaded Notepad++ and and a plugin called Compare. Does anyone think it's the right tool for that ? Any hints about this task ? Is there a way to automate this task ?
User avatar
HerrFornit
Posts: 458
Joined: Sat Feb 25, 2017 12:27 pm
Location: Dortmund
Contact:

Re: Converting *.prs files to xml automaticaly

Post by HerrFornit »

Hi magmavander,

if you don't plan to compare pairwise a whole folder (all pairings !!), perhaps the windows filecompare command "fc" does the job? According to "fc /?" help it's for ASCII and binary.

a short test with comparing a text file with itself gave me the feedback, that "no differences are found":
fc D:\temp\test.txt D:\temp\test.txt

So at least you get the information if the files are the same. Differences in e.g textlines can be displayed, too. But that's complicated....? With your notepad++ you can build pretty easy a batch file (use ALT + mouse or ALT+SHIFt+Mouse for column mode !!)

perhaps one step before :
dir *.prs > myPRSfiles.txt (open in notepad++ for editing columns)

according to the comand above your batch could then be:
fc "D:\temp\Arguelles Alpha.prs" "D:\temp\Arguelles Alpha1.prs" > results.txt
fc "D:\temp\Arguelles Alpha.prs" "D:\temp\Arguelles Alpha2.prs" >> results.txt
and so on ...

The double >> does append the next result.
Then after running your batch open the results.txt in notepad++.
User avatar
IXix
Posts: 1141
Joined: Wed Nov 23, 2011 3:24 pm

Re: Converting *.prs files to xml automaticaly

Post by IXix »

A dedicated duplicate file finder would probably be best if you have lots to do. I'd like to recommend an open source one but TBH all of those I've tried have been unsatisfactory, so I still use the free version of Duplicate Cleaner.

I don't know that plugin so I couldn't say whether it's any good. I use WinMergefor comparing files and folders.
User avatar
magmavander
Posts: 714
Joined: Tue Nov 22, 2011 5:22 pm
Location: France
Contact:

Re: Converting *.prs files to xml automaticaly

Post by magmavander »

Thanks both of you :D
I'll try your suggestions. I have VERY MUCH prs file (more than one thousand...).
I am the guy who keep everything :mrgreen:
User avatar
HerrFornit
Posts: 458
Joined: Sat Feb 25, 2017 12:27 pm
Location: Dortmund
Contact:

Re: Converting *.prs files to xml automaticaly

Post by HerrFornit »

puhh, 1000 .prs !. :!:

ok, I was curious. intresting problem...


This batch worked here with my probe files:

@echo off
for /R %%f in (*.prs) do (
for /R %%g in (*.prs) do (
fc "%%f" "%%g" > nul && if %%f NEQ %%g Echo Same %%f %%g >> result.txt
)
)



put this hieroglyphs in a .cmd file and execute it in your .prs directory (backup of course ;) )
In the result.txt file you should find the "same" file pairings. (Sorry for double entry). Select one of the files you want to delete.
(or if you dare, you can replace the "Echo Same %%f %%g >> result.txt " command with "del %%g" for automatic deleting, probably resulting in some error messages because files then are missed for comparing, but works)
if you run it again delete the result.txt file first.

May take a while with 1000 files !!! A million comparisons?

i
User avatar
HerrFornit
Posts: 458
Joined: Sat Feb 25, 2017 12:27 pm
Location: Dortmund
Contact:

Re: Converting *.prs files to xml automaticaly

Post by HerrFornit »

just for (my) fun, here is a refined version, processing about 100% faster.
Only problem is, when filenames contain "!" these files can not be processed, didn't find a good solution. Maybe some programming expert can solve it....
As above, you can use it to find double dll, too. Just change the extension from .prs to .dll


@echo off
setlocal enableDelayedExpansion

dir /B /S *.prs > prsfiles.txt
if exist PRSresult.txt del PRSresult.txt
set /a countn=2
set /a i=1

for /F "delims=" %%j in (prsfiles.txt) do (
set files[!i!]=%%j
set /a i+=1
)

rem echo %i%
set /a i-=1

for /L %%m in (1,1,%i%) do (
echo | set /p=_%%m
for /L %%n in (!countn!,1,%i%) do (
fc "!files[%%m]!" "!files[%%n]!" > nul && Echo Same !files[%%m]! !files[%%n]! >> PRSresult.txt
)
set /a countn+=1
)
endlocal
User avatar
magmavander
Posts: 714
Joined: Tue Nov 22, 2011 5:22 pm
Location: France
Contact:

Re: Converting *.prs files to xml automaticaly

Post by magmavander »

Hey thanks HF :D
I will try it soon!
Thanks for all the help.
Post Reply