Quote:
Originally Posted by MusoBob
|
Alright, that script by X-Raym put me on the right track and I finally got it working.
Here's how you can do it:
First make a lua script with something along the lines of this:
Code:
local pos_a, pos_b = reaper.GetSet_LoopTimeRange( false, false, 1, 1, false )
local pos_str = pos_a .. ";" .. pos_b
reaper.SetProjExtState(0, "GOLI_WEB", "lts_pos_str", pos_str)
Then within the web control code start the retrieval like so:
Code:
wwr_req_recur("GET/PROJEXTSTATE/GOLI_WEB/lts_pos_str",100);
and add something like this in the web controls
wwr_onreply(results) function:
Code:
case "PROJEXTSTATE":
// Returns: PROJEXTSTATE \t section \t key \t string
if ((tok[1] == "GOLI_WEB") && (tok[2] == "lts_pos_str")) {
tmp_str = tok[3].split(";");
last_lts_pos[0] = parseFloat((parseFloat(tmp_str[0])).toFixed(11));
last_lts_pos[1] = parseFloat((parseFloat(tmp_str[1])).toFixed(11));
}
break;
So it basically boils down to:
- Put the needed information within lua into a string and set as a key-value pair with the SetProjExtState() API
- Retrieve the information in the web control via the GET/PROJEXTSTATE/section/key API and parse it as needed
This means we can pretty much transfer whatever might be needed to the web control. So yeah, not straightforward at first, but doable. Good stuff!