How to change Midi CC to aftertouch in midi machine

I don’t want to use the aftertouch option (using velocity) but use an expression-pedal to control aftertouch in an addressed synth.
In some DAWs I can do that with a midi-transformer but not in all. So I would like to do that in MidiGuitar to be independent from DAWs or standalone-synth.

I did this so far but no result:
function OnNote(channel, pitch, velocity)
– for any note played, send out the exact same note
Note(channel, pitch, velocity)
end

function OnControl(channel, cc, value)
– Control(2, 20, value) --this works when I move the expression pedal
AfterTouch(channel, 60, value) --this does not send out aftertouch when I move the expression pedal
end

function OnFrame(notes)
end

function OnStart(info)
– assign a description to be displayed in the header
info.description = “transforms midi CC to aftertouch”
end

you may need to swtich the aftertouch on in the interface. and block this original aftertouch…

The idea is to convert cc to aftertouch.
The aftertouch option in the interface converts velocity to aftertouch as I understand it.
There is a midi-machine example of converting aftertouch to cc, so I thought it would be possible the other way around.
But I seems not to work the way I scripted it. I also tried with enabled aftertouch option in the interface.
I thought if I send AfterTouch(channel, 60, value) I would just do that.

it kind of works this way with pitchbend, so I thought maybe would this also work with aftertouch. I have indeed never wanted to convert from cc to aftertouch ( I actually added the aftertouch2cc at the time)
Maybe try to echo the existing OnAftertouch data first, and try mod that. I never tested the aftertouch() function…

I think it could be a good feature.
I played around with Arturia Analog Lab V presets. A lot of them have cool aftertouch settings.
To have this controlled with MG2/aftertouch = velocity is confusing as there are also parameters assigned to velocity on those presets.
Therefore to have a pedal sending CC11 being converted to aftertouch would separate velocity from aftertouch.
The aftertouch() is mentioned in the “Demo Script.lua” so I guess it is supported.
Thanks for your reply.

I found this page:
https://www.jamorigin.com/products/midi-machine/
Here it says that the aftertouch functions are not implemented yet.
Is this still true?
Why is it in the “Demo Script.lua” ?

I dont know, I made that demo script spontaneously, I never checked the function aftertouch() because nobody asked for it at that time. I was workign for JO at that time, I quit in oktober 2020. The midi-machine web page was never complete (and I wasnt the web editor), so I auctually didnt look there at all.