Old 01-18-2019, 02:22 AM   #1
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 109
Default Is ProjExstate appropriate for this?

So i want to do some scripts that do stuff (write, read, modify) on files on a given path. These scripts will be used in different computers so the path will be different on each machine.

On top of that, i´d want these scripts to retain a different path depending on the project. So i can have for example:

projectA.rpp --> Run script --> Define path "C:"
projectB.rpp --> Run script --> Define path "C:\something"

Then i´d probably want other scripts to access those paths, to do different things with the files on those folders.



Looks like ProjExstate can be used for that? Note that i dont want to reference these paths from other projects so i am not sure if its maybe too much, if there´s an easier alternative.

I am a bit lost about the use of ProjecExtstate anyway (bear in mind, i´ve been just recently exploring reaper scirpting):

reaper.SetProjExtState( proj, extname, key, value )

- I am confused as to why i have a k and v there and what they are. Should i create a table then just to use ProjExtState?
- Also confused about extname: (Typically extname will be the name of a reascript or extension section) --> should i create then a script just to get the path, then create the table inside it with key (dont seem to need it) and value (the actual path)?
- I am confused, did i say that?
reapero is offline   Reply With Quote
Old 01-18-2019, 08:09 AM   #2
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 109
Default

After some more tries,if anyone reads this, the answer is yes. That seems to be what ProjExstate does.

You can set proj to "0" to use the current project and the rest of stuff seem to be arbitrary: you can add whatever you want in extname and key, only thing is you´d need to call this later when you use getProjExtState.
reapero is offline   Reply With Quote
Old 01-20-2019, 07:11 AM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 11,797
Default

The documentation (https://www.reaper.fm/sdk/reascript/...etProjExtState) explains:

Quote:
Save a key/value pair for a specific extension, to be restored the next time this specific project is loaded. Typically extname will be the name of a reascript or extension section. If key is NULL or "", all extended data for that extname will be deleted. If val is NULL or "", the data previously associated with that key will be deleted. Returns the size of the state for this extname.
Two notes that the documentation leaves out: extname and key are both case insensitive, and key should be a simple string (no newlines, quotes, or <> characters in it).
Justin is offline   Reply With Quote
Old 01-21-2019, 04:25 AM   #4
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 109
Default

Hey Justin,

I think the decription is a bit misleading, specially this:

--Typically extname will be the name of a reascript or extension section

I just found anything you type there works (at least for these first tests i did) and i still fail to understand why this should typically be a script name or an extension.


Also this

-- Returns the size of the state for this extname.

The size in what units? Whats exactly a size of a state?


These concepts might be easy to grasp for somebody with some sort of programming experience but, as someone new getting into it, i cant help but struggle.

Thanks!!
reapero 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 11:33 PM.


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