Old 04-21-2012, 04:31 AM   #1
jnif
Human being with feelings
 
jnif's Avatar
 
Join Date: Dec 2008
Posts: 2,111
Default How to get config vars in Python?

I'm trying to check the state of envattach variable in Python script.
I guess it should be possible with these functions:
RPR_projectconfig_var_getoffs
RPR_projectconfig_var_addr
RPR_get_config_var

How do those functions work?
Are there any Python ReaScript examples where those functions are used?

jnif
jnif is offline   Reply With Quote
Old 04-23-2012, 09:50 AM   #2
jnif
Human being with feelings
 
jnif's Avatar
 
Join Date: Dec 2008
Posts: 2,111
Default

Finally got it working.
Here is my solution:
Code:
from reaper_python import *
from ctypes import *

offset = RPR_projectconfig_var_getoffs("envattach", 0)[0]
envAttach=RPR_projectconfig_var_addr(RPR_EnumProjects(-1, "", 0), offset)
p=rpr_packp('void*',envAttach)
pp=cast(p, POINTER(c_int))
envAttach=pp.contents.value
Is this the correct/best way to do it?


jnif
jnif 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 07:54 AM.


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