convert a group of mscz to pdf
hello,
is there a way to batch convert to .pdf? i have a whole bunch of .mscz files that i want to turn into pdf files. i don't want to have to go to each file and convert individually.
thanks,
ryan
hello,
is there a way to batch convert to .pdf? i have a whole bunch of .mscz files that i want to turn into pdf files. i don't want to have to go to each file and convert individually.
thanks,
ryan
Do you still have an unanswered question? Please log in first to post your question.
Comments
You could post them on MuseScore.com. I can write a batch importer if needed.
Or you could do on the command line, for one mscz file,
mscore file.mscz -o file.pdf
. Depending on your operating system, you can do it for more with a script.In reply to You could post them on by [DELETED] 5
I'm using Cygnus make and a simple makefile which just uses implicit rules to generate xml- and pdf- files, could easily get extended to generate wav- and ogg-files or convert cap- into mscz-files:
Downside: blanks in filenames don't work whit this.
In reply to I'm using Cygnus make and a by Jojo-Schmitz
Something like
for /f "tokens=*" %%a in ('dir /b *.mscz') do C:\MuseScore\win32install\bin\mscore.exe %%a -o %%a.pdf
would do it as wellIn reply to Something like for /f by [DELETED] 5
not quite
a) it generates everything whether needed (mszc newer than .pdf)
b) fom foo.mscz it generates foo.mscz.pdf rather than foo.pdf
Thanks anyway, I'd know how to do this in a shell-script for Linux, but not how in a batch file on Windows...
In reply to not quite, but close by Jojo-Schmitz
Make it
for /f "tokens=*" %%a in ('dir /b *.mscz') do C:\MuseScore\win32install\bin\mscore.exe %%a -o %%~na.pdf
to remove the extension. Comparing the dates coud be done as well.
In reply to Make it for /f "tokens=*" %%a by [DELETED] 5
Excellent, thanks!
In reply to Make it for /f "tokens=*" %%a by [DELETED] 5
Sorry for the thread bump, but this is great info, and I'm wondering if anyone has thought about making a GUI wrapper for this?
Assuming not, and that this were something I were to want to undertake, what sort of environment might people recommend using for a very simple app like this? One of the Python GUI frameworks? Last time I did anything like this, "HyperCard" was all the rage (you younger folk may want to Google that one :-)
EDIT: maybe this is just as easily done as a plugin? looking into that now...
In reply to Sorry for the thread bump, by Marc Sabatella
I've got something working as a plugin. Not ideal, but it works. Run the plugin, select a folder, it finds all MSCZ files without a corresponding PDF, or for which the PDF file is out of date, and loads the MSCZ files then saves as a PDF. Seemed more elegant than trying to invoke a MuseScore (via command line) from within MuseScore - plus I'd have had to worry about the path to the executable. Main drawback of my approach is that the scores loaded via the plugin cannot be closed automatically.
I've attached the preliminary version of the plugin; if anyone wants to give feedback before I post it for real, feel free.
In reply to I've got something working as by Marc Sabatella
Please file a feature request in the issue tracker (if not already done) for closing a score from the plugin framework.
In reply to I've got something working as by Marc Sabatella
Excelent idea! And it works quite well too, but:
I've created #13301: Need means for closing a score from the plugin framework
In reply to Good stuff by Jojo-Schmitz
Thanks, I agree, close would be good, as would enabling the Plugins menu even with no score open.
For debugging purposes, I did originally have a dialog pop up telling me which scores were being converted. I considered leaving that in, but then I realized it was obvious enough which scores were being converted because the scores weren't being closed :-). So I figured the scores themselves served as their own status alerts, and having to hit OK to close a dialog is just adding to the pain of needing to close all the tabs for the newly opened scores. Would be better if they showed their names, though, I agree. I note the score.name field doesn't actually appear to work, and that's probably related.
In hindsight, these limitations are such that doing this as a standalone utility would probably have been better, but what the heck, this is already done, and I can live with its limitations.
Oh, most bothersome to me - no way to specificy a reasonable initial folder. I'd love it to be the folder the user specified as the default score location in Preferences, but there's not a way to get at it that I know of. I did manage to (accidentally) stumble on a simple way to make it remember the specified folder between invocations, though.
In reply to Thanks, I agree, close would by Marc Sabatella
score.name
is not supposed to work. You can get the title withscore.title
.score.close()
will be in 1.2In reply to score.name is not supposed to by [DELETED] 5
So this should work?
and score.title is really the title, not the lable on the tab, which reads "unknown" rather than the plain filename
In reply to So this should work? if by Jojo-Schmitz
Yes it would work but why bother checking the version?
Just do
if(theScore.close == 'function')
theScore.close();
In reply to Yes it would work but why by [DELETED] 5
Ah, very clever
I'm not really familiar with JavaScript, much more with C
Remaining problem: loading a score with score.load() leaves the tab being intialized with the word "unknown" rather that the filename (without path and extension) as it would when opening a score via the menu.
Bug?
In reply to score.name is not supposed to by [DELETED] 5
Great! Dumb question, but what is score.name supposed to be for? idoesn't seem to contain anything that I can tell. I had once tried to write a plugin to export the current score as a PDF with the same base name (slightly easier than Save As and changing file type), but couldn't et at the filename of the current score - that's what I expected to find in score.name.
EDIT: It's coming back to me now. "name" is no longer documented (looks like it was plled a few months ago), as apparently it never worked.
In reply to Great! Dumb question, but by Marc Sabatella
score.name
is nothing. It's not mapped in the C++ code. So there is no name property available on the Score object . It's not even in the documentation :)Ok, I still see it in some plugins. So historically it was probably available but currently it doesn't exist anymore.
In reply to score.name is nothing. It's by [DELETED] 5
OK, but what about that remaining problem: loading a score with score.load() leaves the tab being intialized with the word "unknown" rather that the filename (without path and extension) as it would when opening a score via the menu.
Bug?
In reply to OK, but what about that by Jojo-Schmitz
It's fixed in r4891
In reply to It's fixed in r4891 by [DELETED] 5
This is trunk, right? Too difficult to fix in branch too?
In reply to This is trunk, right? Too by Jojo-Schmitz
This is branch. Trunk plugins are not working for me for the moment. So I can't test. I will fix in the trunk if needed ASAP.
In reply to This is branch. Trunk plugins by [DELETED] 5
Very good.
But there's still another issue: the plugins menu is not selectable as long as no score is open.
Some other menus are selectable where it doesn't make any sense are selectable though: File -> Save online and Edit -> Voices (but not the submenu after that)
Marc: are you going to submit this plugin to the plugins page?
In reply to Still one issue left... by Jojo-Schmitz
Yes, I will. I will first add the code to close the tabs if the close function exists (I never would have thought of that particular method of checking, either!), and then pop up a status report, so it will be 1.2 ready right off the bat.
In reply to Yes, I will. I will first by Marc Sabatella
Done:
http://musescore.org/en/project/batchpdf
I ended up liking the status dialog enough that I pop it up even if close() isn't available and the scores are left open.
In reply to Done: http://musescore.org/en by Marc Sabatella
Great stuff, thanks.
Could that possibly get extended to export other formats too? Like xml, ogg, well actually everything the "Save As" allows for? Maybe having a set of tick boxes for all the different formats in the 'select directory' dialog, PDF being ticked by default? Of course it'd be possible to create different plugins for every format out there, but that would be unneccessary code duplication to me.
I have no idea though how to code such a format selection screen, everything after that should be fairly simple?
Furthermore: there's a bug(let): if you don't select a score (i.e. hit cancel in the "select directory" dialog) it (rightfully) gives an warning message "No folder selected", but after that if gives another message "All files up to date". A simple "return;" right after that 1st message fixes this.
As a first step I've removed all references to PDF and modified so that changing the to be exported file type only needs to be done in one place (currently "pdf", actually an array with only one member, changing that to "pdf","xml" is just enough for me right now), and fixed above mentioned buglet.
In reply to Yet another request ;-) by Jojo-Schmitz
More great ideas, thanks! Would you like me to add you as a maintainer so you can add improvements yourself?
I did think about extending this to other formats, but I didn't want to mess with the simplicity of the experience for the user. If I knew how to create a dialog that had the folder selection widget and checkboxes for format together in the same place, that wouldbe good, but as it is, the only way I'd know how is to introduce another dialog. i guess that's not the end of the world if it defaults to PDF, but I'm still very clumsy working with Qt GUI components, so this would be more work than I thought it was worth.
Ome reason I didn't comsider it important is that batch PDF export is going to be far more common than batch audio export, at least for me. The most common situatuion is a folder containining an ensemble score with a bunch of parts, and I want PDF's of all the parts to distribute to the players. The only audio file I'd ever want in that situation would be for the whole score. I also have a folder full of lead sheets, and could see wanting them converted to PDF as a batch - but again, not very likely for audio, since audio for lead sheets is not normally meaningful. MusicXML wasn't even on my radar, but probably should have been.
So since batch export of audio is not something that is likely to come up for me, I didn't want to complicate the export plugin (both as a programmer and as a user) just to accomodate that possibility. I do like the idea of parameterizing the output format in the code to make it easier to create a new version of the plugin for another format, though. And if someone else wants to design a nice UI and the supporting code to allow selection of format, I'm happy to check that in.
In reply to More great ideas, thanks! by Marc Sabatella
If you keep on working together on this, I suggest using a SCM. I posted all my plugins on http://github.com, it's easy to browse the source and it makes a zip file for each project. Setting up a git repo is a little bit challenging but they have nice tutorials
In reply to More great ideas, thanks! by Marc Sabatella
Yep, I'm fine with becoming maintainer of that plugin. And I agree PDF should be the default export format, as the most commonly needed one.
I'd need to have a deep look into how UI programming works with QT...
Need to look into that github thing too ;-)
Found another bug:
On '=' too many.
In reply to Yep, I'm fine with becoming by Jojo-Schmitz
===
is fine. See https://developer.mozilla.org/en/JavaScript/Reference/Operators/Compari…typeof sends back a string so it's ok.
Btw, it's Qt and not QT. Designing interface is quite easy, just install the Qt SDK or Qt Creator and there is a visual tool to create *.ui file. These UI files can be loaded in a plugin. Check the "Break every X measures" for a simple example. Communication between UI and the code is done with slots and signals. Look for
connect
in the code of the plugin to see how to connect a signal with a slot.In reply to === is fine. See by [DELETED] 5
Yep, thanks found that out myself meanwhile. As said earlier I'm more a C programer than JavaScript...
In reply to Yep, I'm fine with becoming by Jojo-Schmitz
Ok, you're in now as co-maintainer. Feel free to make any of the changes you like.
Btw, I used the === because that's how it showed up up in the "typeof" sample code I found online. I hadn't seen it before, either. I realized == should probably work as well, but given this was code I couldn't fully test, I wasn't taking any chances.
In reply to Ok, you're in now as by Marc Sabatella
Thanks. Most probably I won't find the time until after my vacation, so I'll have a look after Nov 5th...
Edit: I couldn't stop myself from doing it now ;-). Fixed the buglett and also have the code in place to enable exporting multiple formats. No GUI yet though..
In reply to Thanks. Most probably I won't by Jojo-Schmitz
Great, thanks!
In reply to Thanks. Most probably I won't by Jojo-Schmitz
You'll probably enjoy your vacation more, as a side benefit.
Have a great time.
Regards,
In reply to Wat to go Jo-Jo. by xavierjazz
Another small improvement: you can now even import files, so the plugin isn't restricted to work on mscz files anymore
Still no GUI though ;-)
In reply to Another small improvement: by Jojo-Schmitz
Have a GUI version ready now, but would like proof readers, testers and translators (yes, infrastructure for translation and a German one is included now too) before I 'officialy' publish it on the plugins page.
In reply to Batch Export with GUI by Jojo-Schmitz
Cool! A quick check shows no obvious problems, but I do have a few observations:
Why radio buttons rather than checkboxes for input format? Seems it should be perfectly possible to handle multiple input formats as well as multiple output formats, no?
I'd recommend putting PDF at or close to the top of the export list - it would make the fact that it is already selected by default more obvious.
As an eventual enhancement, the folder selection dialog could be configured with a filter to show files of the selected input (or input & output) formats only? I don't know how useful that would be in real life, but it would have come in handy as I was testing it, looking for folders that had particular types of files in them to select for testing.
In reply to Cool! A quick check shows no by Marc Sabatella
Changing the radioButtons to checkBoxes is what I have on my ToDo list already (also grouping them, e.g one checkbox for all 3 MuseScore formats, similar for MIDI), but this could get tricky, e.g. what to do if I select *.mscz and *.mscx as the inFormats and there is a foo.mscz and a foo.mscx, which to take to convert into outFormats? First come, first serve? Which one of the two to take to check wheter any of the outFormats is out-of date?
Another problem I see (and like to be fixed) with multiple outFormats is that it should be sufficient to open the inFile only once, currently it is opened outFormat.length times. Esp. an issue with 1.1, which keeps them all open.
So I have to think about these issues a bit more...
The order on the dialog is derived from how MuseScore's open/save dialogs show them, I'd rather keep it that way.
I like the idea of filtering the folder select dialog to inFormat and possibly outFormts, will look into this.
[edit] Unfortunatly QFileDialog.getExistingDirectory() doesn't have this property , at least I wasn't able to find it?
Another issue I'd need to fix is that while the form is at display, I'd need to disable (and uncheck) an outFormats checkBox if the same format is being selected as inFormat and enable it again when another inFormat get's selected. No idea how to that though? Currently I ignore these in the scipt, but that ain't nice, GUI wise.
And another one: some inFormat come in lower and upper case (BB files, *.mgu and *.sgu vs *.MGU and *.SGU), would I need both in the selection? Not in Windows, I think, if I remember correctly no Windows file system (FAT, NTFS) is case sensitive, but how about Linux and Mac?
In reply to Changing the radioButtons to by Jojo-Schmitz
I had seen a Filter method on the file dialog class itself, although I haven't tried it so I don't know how it works.
I see your point about possible conflicts if you allow multiple input formats. My instinct is to not worry about it and just let the results be undefined. I'd expect it to not crash, but would imagine both files would get converted, with one output file overwriting the other.
I also understand the order listed in the dialog (although now I wonder why it is like that in open and save), but still wonder if something couldn't be done to make the current selection more obvious. Can the labels for the currently selected items be made bold? Not terribly important, of course.
In reply to I had seen a Filter method on by Marc Sabatella
I can set inFormat *.mscz and outFormats *.pdf bold and have a button 'reset to defaults'.
I have not been able to toggle the boldness with the selection.
But I found a way to disable an outFormat if it conflicts with an inFormat.
And fixed a few bugs along the way...
Edit: now it has checkboxes for the inFormats (i.e. we can have more than one at a time) and it opens every inFile only once, even if multiple outFormats are selected. Also it now gives a porper warning if no input- or output format had been selected.
Let me know what you think about this version, as far as I'm concerned if is ready for the plugins page
In reply to I can set inFormat *.mscz and by Jojo-Schmitz
Looks great! I guess some might question whether it's worth boldfacing the initial/default choices if you can't update the labels on the fly, but I think it is. Especially with the Reset to Defaults button - it helps identify what the defaults are. At some point I may go in add code to bold the labels on the fly (I'm pretty sure this would be possible by connecting methods to each of the checkboxes, but if I do, I'll probably add some other indicator of what the defaults are.
In reply to Looks great! I guess some by Marc Sabatella
Yeah, I didn't say that changing the boldness is not possible, just that I didn't manage to find how...
Found a minor issue meanwhile (the 'reset' button became the default button after first use), the final version will have that fixed, of course.
Would be nice to have some more translations available though, spanish and french maybe, lasconic?
In reply to Yeah, I didn't say that by Jojo-Schmitz
Quick translation
In reply to French Translation by [DELETED] 5
Thanks! Integrated...
comment redacted