Old 09-26-2016, 05:20 AM   #1
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default Q: ReaScripts, Dockers and Screensets

Is there a way for a reascript to know which screenset is loaded?
It seems loading a screenset refreshes windows and dockers positions etc, but nothing is stored anywhere to say, current screenset is number 1 or number 2 for example.

I want to be able to automatically change docker of a reascript window in a different one if a different screenset is loaded.

Or maybe the solution is to force a certain docker to have certain ID before saving the screenset. so the reascript can always have the same docker ID, but that docker can be positioned in different locations.

there are some docker functions but I have no idea how they work.

Dock_UpdateDockID
DockIsChildOfDock
DockWindowActivate
DockWindowAdd
DockWindowAddEx
DockWindowRefresh
DockWindowRefreshForHWND
DockWindowRemove


I've tried reaper.Dock_UpdateDockID(desireddockid, currentdockid)
but it doesn't work.
Anyone knows what all these dock functions do?
heda is offline   Reply With Quote
Old 09-27-2016, 04:59 PM   #2
sebas777
Human being with feelings
 
sebas777's Avatar
 
Join Date: Nov 2006
Posts: 2,182
Default

Hello HeDa,

I've asked almost the same question recently http://forum.cockos.com/showthread.php?t=181602 (not getting any answer).
sebas777 is offline   Reply With Quote
Old 09-27-2016, 07:20 PM   #3
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

I track and load the dockstate and other options of some scripts in the REAPER EXT state. The ext_option function defines a default and writes the value to the EXT state if it is not present, otherwise loads the stored one. The init_ext_options just shows how I handle loading gfx_init.



IN EEL (so you'll need to translate to lua - good luck)


Code:
function ext_option(extname,key,default,newval,setnewval)local(getvalue,setvalue,value)
// int  int_option("section", "key", int default, int newval, bool setnewval)
//saves key in reaper-extstate.ini
(
  getvalue=#; setvalue=#;
  !HasExtState(extname, key)  ? (
    sprintf(setvalue,"%i",default);
    SetExtState(extname, key, setvalue, 1);
  ); 
  setnewval ? (
    sprintf(setvalue,"%i",newval); 
    SetExtState(extname, key, setvalue, 1);
    setnewval=0;
  );
  HasExtState(extname, key) ? ( 
    GetExtState(getvalue, extname, key); match("%i",getvalue,value); 
  ); 
  value;
);

//init_ext_options("EXAMPLE",dockstate,width,height);
function init_ext_options(section_string,dockdefault,widthdefault,heightdefault)
local(proj,dockstate,width,height)
(
  proj=EnumProjects(-1, "");
  dockstate=ext_option(section_string,"dockstate",dockdefault,0,0);
  width=ext_option(section_string,"display_width",widthdefault,0,0);
  height=ext_option(section_string,"display_height",heightdefault,0,0);
  gfx_init(section_string, width, height ,dockstate);
);

So you could use a similar scheme, but create EXTstate values for each screenset.


If there isn't a way to track the screensets, I guess you could script your own screenset changer - which would setnewvalues to the EXT state for each particular Section (script) - and those scripts would have to monitor for changes to the ext state and set themselves accordingly.

within a script, I use the following scheme to store the options whenever they change.

This is for width and height (I just relize my dockstate scheme isn't exactly right at the moment but yeah I just cache the values and check for changes)
Code:
    width=ext_option(#section,"display_width",150,max(gfx_w,150),gfx_w!=wcache);
    wcache=gfx_w;
    height=ext_option(#section,"display_height",500,gfx_h,gfx_h!=hcache);
    wcache=gfx_h;
This should work in reverse as well. So if some other script changes the EXT state it should just change. (but not %100 on that - might need to rework it.)

Last edited by James HE; 09-27-2016 at 08:09 PM.
James HE is offline   Reply With Quote
Old 09-28-2016, 09:26 AM   #4
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

Thanks James, the problem is not storing the variables, the problem is not knowing which is the last active screenset. When you click to load a screenset it loads it and changes all the windows and dockers, and the screenset font gets bold indicating that you loaded that one, but it is not stored anywhere that particular screenset was loaded. At least I can't find it. And if you restart REAPER, and open the screensets window again, the last loaded screenset is not bold anymore. So that's the problem.
I was wondering about that Dock_UpdateDockID function in particular. But I don't know how it works or what it does.
heda is offline   Reply With Quote
Old 07-30-2020, 07:54 AM   #5
nikolalkc
Human being with feelings
 
nikolalkc's Avatar
 
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
Default

Four years later is this still a mystery?
__________________
Youtube | Website | Twitter
nikolalkc is offline   Reply With Quote
Old 07-30-2020, 12:44 PM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Isn't the last screenset stored in reaper.ini?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-31-2020, 12:32 AM   #7
nikolalkc
Human being with feelings
 
nikolalkc's Avatar
 
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
Default

I don't know, maybe, didn't look. Thanks for that.

But, what about those docker functions?
If I am correct most of them are still undocumented.
__________________
Youtube | Website | Twitter
nikolalkc is offline   Reply With Quote
Old 07-31-2020, 06:55 PM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Ok, at last I can answer one question for now: you cannot find out currently, what the last or the currently used screenset is, as it's only stored in memory of Reaper and nowhere else.

In regards of the docker-functions: I have this feature-request which I'm dropping in here, for completion of docker-related functions, as some are missing from the whole docker-business.

https://forum.cockos.com/showthread.php?t=222314

Feel free to chime in. With them added, I can document them all.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-07-2020, 05:02 AM   #9
nikolalkc
Human being with feelings
 
nikolalkc's Avatar
 
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
Default

Thank you very much.
This is already helpful.
__________________
Youtube | Website | Twitter
nikolalkc is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.