MIDI export script

saxysellig
saxysellig Member Posts: 1 Newcomer
edited October 22 in Kontakt

Hi,
I want to be able to export my piano improvisations in Kontakt 7 Player to MIDI files but I'm a complete newbie to scripting so I found a YouTube tutorial about this and I typed the script below in KSP.
When I play a few notes and then click on the Export button, I get the success message "Export successful: test"... but there's no file in the @path folder!?
Can anyone help me, please?

*

on init
make_perfview
set_script_title("Export MIDI")
message("")

declare @path
@path := "C:\Users\Gilles\Bureau"

declare ui_text_edit @file_name
set_control_par_str(get_ui_id(@file_name),$CONTROL_PAR_TEXT,"<empty>")
make_persistent(@file_name)

declare ui_button $Export

declare $save_mf_id
$save_mf_id := -1
end on

on ui_control($Export)
$save_mf_id := save_midi_file(@path & @file_name & ".mid")
end on

on async_complete
if ($NI_ASYNC_ID = $save_mf_id)
$save_mf_id := -1
$Export := 0
if ($NI_ASYNC_EXIT_STATUS = 0)
message("Error!")
else
message("Export successful: " & @file_name)
end if
end if
end on

This discussion has been closed.
Back To Top