Question: Could you provide a working example for PromptForAction in C++?
Asked by Navelpluisje (62.45.64.x) on October 7 2024, 3:22pm
Reply on October 8 2024, 12:33am (edited at October 8 2024, 12:38am):C++ would require too much boilerplate, here's lua, but you'd use a timer rather than defer() etc:
function run()
hit = reaper.PromptForAction(0,0,0)
if hit == 0 then
reaper.defer(run) -- keep trying until PromptForAction succeeds or fails
else
reaper.MB(string.format("action %d",hit),"action sel",0)
end
end
reaper.PromptForAction(1,0,0)
reaper.defer(run())
Comments:
- Posted by Navelpluisje (62.45.64.x) on October 8 2024, 5:09am:
Thanx for the reply. I already had this working in LUA. The thing is I'm now working on a csurf extension with some options for setting different actions for the function keys. This is now in C++. Can you at least give a directions? I'm not a C++ god, but want to make the extensions as user friendly as possible. Thanx
- Posted by Justin on October 8 2024, 4:12pm:
how about this? 1014.org/_/prompt_for_action.txt
- Posted by Navelpluisje (89.255.38.x) on October 8 2024, 5:06pm:
Cool, thanx. Will give it a try
- Posted by Navelpluisje (62.45.64.x) on October 8 2024, 9:23pm:
Somehow `const int res = PromptForAction(0,0,0);` is always returning -1. Looks like the session somehow is not available anymore. Will drop this into the forum again. Then this also gets shared
- Posted by Navelpluisje (62.45.64.x) on October 9 2024, 7:13am:
Just man to let you know it's working. Forgot to remove an old ShowActionList call. Many thanx for this
Comment: