ChatGPT for creating LUA scripts

Today I have asked ChatGPT if they knew to program with the script used by Dorico. They said me that they could. I have tried to ask them for some simple scripts but they don’t work…
Has anybody tried to use ChatGPT for creating scripts? Are they really able to create them?
Thank you in advance!

Because relatively few Dorico-flavoured Lua scripts have been posted online (and posted online before September 2021, to boot), I suspect ChatGPT doesn’t actually know enough about Dorico’s scripting to be able to write working scripts, I’m afraid.

1 Like

Thank you Daniel. That seems logical… The code that I have obtained is quite strange, maybe influenced for other music program coding. I hope that with time this will be a reality because it would be very useful…
By the way, I don’t know if you are planning AI integration in Dorico (not only with scripts). I am sure that this will be the key to get the market in a non very far future! Imagine if you could ask in a text box something like: “convert the bars 110 to 130 to major mode and reduce all the fast moving parts of the winds to the piano part”, for example.

Everything I’ve seen from ChatGPT is on a par with a mediocre human.

It’s impressive that a machine can do it – but we don’t have a shortage of mediocrity that needs filling. If an intern came up with the same output, they wouldn’t last long.


I sure would love to read what you got out of the bot. Mind you, strictly for amusement…

1 Like

I’d be interested in seeing it, too.


1 Like
function change_quarter_notes_to_half_notes()
  -- iterate through all notes in the score
  for note in eachentrysaved(finenv.Region()) do
    -- check if the note is a quarter note
    if note.Duration.Equals(finenv.DurationQuarter) then
      -- change the duration to a half note
      note.Duration = finenv.DurationHalf
      -- update the appearance of the note
  -- update the score to reflect the changes


I have no idea if that’s gibberish, or just generic code, or useful at all.

1 Like

finenv / Finale Environment / Finale?


It’s perfectly valid code, which confidently relies on things that just do not exist.
More importantly, it utterly fails to amuse me. :frowning_face:


What was your prompt?

Something like “write a LUA script in Dorico that changes all quarter notes to eighth notes.”

1 Like

Well, look who’s been a good Bing:

A colleague of mine made ChatGPT come up with some Lua code for the Dorico scorewriting application. Can you do that as well?

Bing, 21:21
Yes, it is possible to use Lua scripting with Dorico scorewriting application. You can use Lua to interact with some non-Lua external processes and then make edits to the score automatically[1]. You can also apply slash notation in Dorico via a Lua script[2]. However, designing a scripting API that will be fit for purpose and provides the correct levels of access to the data models and functionality of an application like Dorico is a huge job[3].

Is there anything else I can help you with?


ChatGPT is a tool. You only have to know for what it is useful. A calculator is quite stupid, but it is useful for some interesting things.

First I have asked for a script code to delete articulations. The result:
"function removeArticulations() {
// Obtenir la selecció actual
var selection = Application.getCurrentSelection();

// Comprovar si la selecció és vàlida
if (selection) {
// Obtenir el passatge seleccionat
var passage = selection.CreatePassageChordSelection();

// Comprovar si el passatge té notes
if (passage && passage.GetNumNotes() > 0) {
  // Recórrer totes les notes del passatge
  for (var i = 0; i < passage.GetNumNotes(); i++) {
    var note = passage.GetNoteInChord(i);
    // Eliminar totes les articulacions de la nota
  // Actualitzar la vista de partitura


// Cridar la funció per eliminar les articulacions
After that I gave they a sample of a real script and asked again, and they wrote that:
"-- Crea una instància de l’aplicació DoApp de Dorico
local app = DoApp.DoApp()

– Obté la selecció actual
local selection = app:getSelection()

– Itera sobre els objectes seleccionats
for _, obj in ipairs(selection) do
– Comprova si l’objecte és una nota
if obj.ClassName == “Note” then
– Elimina totes les articulacions de la nota
Quite different! In any case, none of them work… As @dspreadbury pointed out earlier, this may be due to the limited number of code references available on the web until 2021.

I would like to mention that I have used it for coding in Mathematica and it works quite well, except for simple tasks. I am convinced that if there was enough information available on the internet, these tools could be very useful.

Yes, it seems that it tends to make a Finale like code… I have obtained something similar.