Creating a pdf using script

• Sep 2, 2015 - 01:35

Suppose I have an XML file. Is there a way to convert this programmatically to a PDF? I.e. in jscript or javascript or the like?

Thanks


Comments

In reply to by Jojo-Schmitz

I enabled the plugin
I selected a folder one of many in a hierarchy. I first set the conversion from .XML to .pdf
I may have forgotten to unclick .mscz
There were many files in this folder. It appeared to do all the files in all the folders at the same level of the main folder. There were several that were error-prone since they were done in Musescore 1 and I had to answer the yes no etc one at a time. I could put up with that but I would have preferred to say do this for all errors in this run.

Then I noted that no .XML files were converted. In fact it cannot find files with a capitalized file name of .XML

I could rename them all I suppose, but Musescore reads them fine as CAPS.

thanks - I see there are possibilities here.

Bob

In reply to by Bob MacDonald1

The plugin should recure into subdirectories only if explicitly told to (i.e. the corresponding Checkbox is ticked) and as Windows is not case-sensitive (just case-preserving), the plugin shouldn't either. It does though, strange, looking into this...

Ignoring errors sounfs like a nice extension, not sure though the plugin framework allows for that, but indeed having unchecked .mscz should have sorted that for you ;-)

In reply to by Jojo-Schmitz

The fix for uppercase XML is quite easy, just Change the line 409 in batch_convert.qml from
if (inXml.checked) inFormats.extensions.push("xml")
to
if (inXml.checked) inFormats.extensions.push("xml", "XML")
and, strange enough, we did that for the mgu and sgu formats. I wonder whether there is a more elegant solution to this.
Anyway, that simple fix is online now.

EDIT: I just found a much better solution, I changed line 490 from
if (inFormats.extensions[i] == suffix) {
to
if (inFormats.extensions[i].toUpperCase() === suffix.toUpperCase()) {
with the Advantage that it now takes mixed case too. Will be online shortly.

In reply to by Jojo-Schmitz

Thanks

I did download - still gives no files found message for .xml.
I can't read the .md file. A search for xml in the files does not show an to upper function applied.

I am away for a while and will try again later.

I found the code and the toUpper function and this is definitely the right version. Still trying to make it work

In reply to by Bob MacDonald1

Processing finished

A half dozen of the 1000 files would not read without a 'yes' to a yet undiagnosed error - but I got through them

then I recursed a directory that had the java development kit in it with 10000s of xml files - no escape so I had to bring up task manager to kill the app. I think having a do you want to continue or do you want to ignore all subsequent errors is probably important :)

thanks again - all done for now.

Hi again

I have this structure directory main and 40 subdirectories
If I chose a subdirectory and recurse the directories, then all subdirectories are processed.
That's how it worked a few days ago - it didn't seem quite right but it worked.

Now I have to update a half-dozen of the 935 xml files

So the new ones go to my download directory which has in it a subdirectory I don't want to process and I can't move it since I am executing an oracle program there (another problem but not related)

I reexecute the batch convert
I pick downloads and it says it cannot find any files
I try renaming one file to .xml (they are all in caps) and it still cannot find files
I put them in a subdirectory and select that and it still finds no files in the subdirectory but it did find 3 files that were in the main downloads directory. I.e. when I pick a directory, it seems to process the parent of the directory that is picked and not the directory I select.

To prove this I created a dummy directory (empty) in downloads and pick 'dummy' in the batch file select directory dialogue. All the files process, that are on the same level as as the empty dummy directory. Recurse directories is not enabled. Just xml to pdf processing.

This is a bit counterintuitive but I now know how to make it work.

I would expect that I would pick the directory that contains the files I want to convert, not the directory that is at the same level as the files I want to convert.

Do you still have an unanswered question? Please log in first to post your question.