FileIO in MuseScore 3.0.5 plugin ?
Hello
FileIo - to write text file - is not available in MuseScore 3 ?
In MuseScore-2 it was OK ( code sample hereafter)
In MuseScoe 3.0.5 it makes "module "FileIO" version 1.0 is not installed"
Thank you for your help
// Version MuseScore 3 NOT OK //
////////////////////////////////////
import QtQuick 2.2 import MuseScore 3.0 import FileIO 1.0 MuseScore { version: "3.0" description: qsTr("test plugins musescore 3") menuPath: "Plugins.Notes.test" FileIO { // generates module "FileIO" version 1.0 is not installed id: outfile source: "pos.txt" onError: console.log(msg) }
// Version MuseScore 2 OK //
////////////////////////////////////
import QtQuick 2.0 import MuseScore 1.0 import FileIO 1.0 MuseScore { version: "1.0" description: "plugin scan position" menuPath: "Plugins.Notes.scan_position" // output file to save the positions of the notes FileIO { id: outfile source: "pos.txt" onError: console.log(msg) }
Comments
use
import FileIO 3.0
In reply to use import FileIO 3.0 by Jojo-Schmitz
Correct. It works fine . Thank you very much ...
In reply to Correct. It works fine … by Frank Revolle
Example of code to write tick/pitches in a text file, for MuseScore3.
If it can help other users...
In reply to Example of code to write… by Frank Revolle
I'm digging this one. Thanks for sharing your code.
Is there a way to retrieve the path where the plugins are installed ?
source: "./myplugin.properties"/
is in MuseScore bin folder and is not suitable for storing a plugin's property file.source: Qt.resolvedUrl("myplugin.properties")
leads to a non writeable file.source: homePath() + "/myplugin.properties"
is in the middle of nowhere, user's root folder. Not even the "MyDocument" folder. This is the best I've got for now.rootPath()
,currentPath()
,tempPath()
are all returning errors ("ReferenceError: rootPath is not defined")In reply to I'm digging this one. Thanks… by parkingb
For storing the plugin settings you could use a QSettings instance and provide your own category.
See https://github.com/jeetee/MuseScore_SaveAsWithTimestamp and https://github.com/jeetee/MuseScore_DailyLog for two small plugins that use this approach
In reply to For storing the plugin… by jeetee
Thanks. It's working fine. Although as my goal is to save a library of special fingerings (for my Alternative fingering plugin), I wonder if saving this in the registry is a good idea, because you can't backup it, and because of the size of what I would have to store.
I would prefer a regular file.
In case anyone needs to use a file stored in Musescore's plugin folder.
In this case, it manages a file in a fictive "mypluginfiles" subfolder.