Pytohn's ConfigParser comes in handy here. Try this for starters:
import os
import ConfigParser
workSpace = 'Compositing'
iniFile = os.path.expanduser('~/.nuke/uistate.ini') config =
ConfigParser.RawConfigParser()
config.read(iniFile)
config.set('Nuke', 'StartupWorkspace', workSpace)
with open(iniFile, 'w') as fileHandle:
config.write(fileHandle)
On 27/01/17 4:00 PM, Bruno-Pierre Jobin wrote:
I'll keep the HOME variable in mind but it's a bit invasive indeed.
I'll try to parse uistate tomorrow and get back with the results.
Thanks
--
Bruno-Pierre Jobin
On Jan 26, 2017, at 5:55 PM, Frank Rueter|OHUfx <fr...@ohufx.com
<mailto:fr...@ohufx.com>> wrote:
Actually, I just tried and there doesn't seem to be an API for
dealing with workspaces.
However, you could write a simple wrapper script to search and
replace the respective value in your ~/.nuke/uistate.ini (e.g.
startupWorkspace=Scripting)
On 27/01/17 11:42 AM, Frank Rueter|OHUfx wrote:
I see. You could modify your home directory as Jake pointed out.
If that's too invasive, you could try a python script that checks
your environment on startup, and if in DEV mode, changes the startup
workspace.
I haven't tried it myself though.
On 27/01/17 10:47 AM, Bruno-Pierre Jobin wrote:
It’s only for myself. I want the workspace to be set in scripting
mode when I launch nuke from the dev environment. Else I want my
default workspace to comp.
If anyone know how to achieve this, it’d be awesome.
On Jan 26, 2017, at 2:37 PM, Frank Rueter|OHUfx <fr...@ohufx.com
<mailto:fr...@ohufx.com>> wrote:
I don't think this is possible out of the box, so some suctom
python code may be required to parse an arbitrary preference file.
Out of interest, why do you want to do this, seeing the workspace
should be an artist's choice rather than an enforced setting?
Cheers,
frank
On 27/01/17 4:25 AM, Bruno-Pierre Jobin wrote:
Hi,
Is there a way to make Nuke point to a “preferences10.0.nk” file
based on ENV variables? I’m trying to change the startup
workspace based on these variables but it doesn’t work when
specified in the menu.p <http://menu.pt/>y file nor the init.py.
Thank you
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk,http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk
<mailto:Nuke-python@support.thefoundry.co.uk>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk,http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk,http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk
<mailto:Nuke-python@support.thefoundry.co.uk>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python