Midi note to CC1

Hi all,
I think I have a need for a script but i dont know where to start.
I want to trigger a CC1 (value 127) when I hit a certain note, and then CC1 (value 0) when I hit another note. I still want the note to pass through but I just want the CC to trigger.
Can anyone point me in the right direction?
I am using the Rig Manager so I am a bit confused how to give the midi input to the correct variable in the script.

TIA

Something like this: Remap MIDI messages without using the MIDI Filter plugin

Or this: Note on off to midi cc's sugestions - #7 by David-san

I got it to work doing it this way: I’ve left it here for anyone else that is strugling at beginner level.

// This function will execute on receiving a Note On event
On NoteEvent(m : NoteMessage)
    if IsNoteOn(m) and GetNoteNumber(m) == 43 then
         SendNow(MakeControlChangeMessage(1, 80));  // Send CC1 with value 127 on specified channel
    elsif IsNoteOn(m) and GetNoteNumber(m) == 50 then
         SendNow(MakeControlChangeMessage(1, 0));  // Send CC1 with value 127 on specified channel
    elsif IsNoteOn(m) and GetNoteNumber(m) == 40 then
         SendNow(MakeControlChangeMessage(1, 50));  // Send CC1 with value 127 on specified channel
    End
End

Also, if you use On NoteOnEvent instead of NoteEvent then you don’t even have to test whether you have a Note On message