Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Maya 2022.2 where is the command the creates the file scriptEditorTabPrefs.txt

Maya 2022.2 where is the command the creates the file scriptEditorTabPrefs.txt

malcolm_341
Collaborator Collaborator
4,123 Views
29 Replies
Message 1 of 30

Maya 2022.2 where is the command the creates the file scriptEditorTabPrefs.txt

malcolm_341
Collaborator
Collaborator

So in Maya 2022.2 Autodesk has added a new file C:\Users\user\Documents\maya\2022\prefs\scriptEditorTemp\scriptEditorTabPrefs.txt

 

This file now contains the script editor tabs, but not their contents, if Maya crashes you lose any tabs you've created. I had previously created a script that saves these tabs any time you want, but now that they've changed the file my script no longer works I lose my work all the time. Does anyone know what mel command to use to write this file out?

0 Likes
Accepted solutions (1)
4,124 Views
29 Replies
Replies (29)
Message 2 of 30

malcolm_341
Collaborator
Collaborator
Accepted solution

And the answer is for Maya 2022.2 only use this saveScriptEditorTabs();

Otherwise all your script editor tabs will be deleted if you use the command for previous versions of Maya.

0 Likes
Message 3 of 30

brentmc
Autodesk
Autodesk

There is also a new menu item for this: Script Editor > File > Save All Scripts Tabs

 

Brent McPherson
Principle Engineer
0 Likes
Message 4 of 30

malcolm_341
Collaborator
Collaborator

Dang, didn't even see that. Thanks.

0 Likes
Message 5 of 30

malcolm_341
Collaborator
Collaborator

@brentmc 

I'm still losing my work regularly, but I can't track down the bug. If I run my save preferences script and then crash Maya everything is fine and the script editor tabs are preserved, but after I work for a couple days and I'm not paying attention I'll open Maya and all my tabs will be gone and I'll have the default Python tab with a bit of my mel code in it from several days past. Is there a bug on Autodesk's side here, or am I calling the wrong command to save the tabs in 2022? I see there's no echo print out for the new file menu entry so any suggestion would be helpful.

0 Likes
Message 6 of 30

mspeer
Consultant
Consultant

Hi!

 

I can confirm this issue.

I have several MEL and Python tabs open and at least every 24 hours when starting Maya 2022.2 they have been reverted to just the 2 default tabs.

For now I set the "scriptEditorTabPrefs.txt" to read-only, it's not a perfect solution, but it saves me a lot of time.

There is definitely something not working correct since using the new scriptEditorTabPrefs.txt file.

Message 7 of 30

malcolm_341
Collaborator
Collaborator

Thanks for confirming, please let us know if you ever figure out how to repro it. I'm keeping an eye on it, but I can't figure out the steps that cause it.

0 Likes
Message 8 of 30

brentmc
Autodesk
Autodesk

Thanks. I've pinged the dev who worked on this to see if they have any ideas.

Brent McPherson
Principle Engineer
Message 9 of 30

brian.kramer
Alumni
Alumni

Thanks for bringing this issue to our attention. I'm trying to reproduce the issue on my end. If you do come up with some steps please post them.

-Brian

 


Brian Kramer
Software Developer
Message 10 of 30

brian.kramer
Alumni
Alumni

A couple questions for you that may help me figure out the problem.

1) Do you switch between 2022.2 and 2022.1? Or are you solely running 2022.2 now?

2) When it happens have a look in your .../2023/prefs/scriptEditorTemp directory. You should see commandExecuter files that contain the contents of each tab. There should be one for each tab in the Script Editor that is not linked to an external file. I'm curious if these are being removed.

Thanks,

-b


Brian Kramer
Software Developer
0 Likes
Message 11 of 30

malcolm_341
Collaborator
Collaborator

1. I switch between 2017, 2018, 2019, 2020, and 2022.2, but as far as I know after installing the update there is no 2022.1 left on my machine.

2. I can't remember, I'm watching that folder constantly now so I'll let you know as soon as I lose my work again.

0 Likes
Message 12 of 30

mspeer
Consultant
Consultant

Hi!

 

@brian.kramer 

Using Maya 2022.2 only ( I doubt you can have Maya 2022.1 and Maya 2022.2 installed on the same system?!).

As far as I remember only the scriptEditorTabPrefs.txt is changed at first, however after starting with the changed scriptEditorTabPrefs.txt only the 2 default tabs show up and when then again closing Maya the non-default commandExecuter files will be removed.

That's why my workaround by setting the scriptEditorTabPrefs.txt to read-only works very well for me.

0 Likes
Message 13 of 30

malcolm_341
Collaborator
Collaborator

But don't you then also need to set it to writable each time you want to add a new tab?

0 Likes
Message 14 of 30

mspeer
Consultant
Consultant

Hi!

 

That's correct, but I have so many tabs open that I don't need any new tabs.

I use a constant amount of tabs since several years.

0 Likes
Message 15 of 30

malcolm_341
Collaborator
Collaborator

Ah yes I see, ha ha. Well I went a different route for fun, I wrote a script that copies the tab.txt and the commandExecutor files to a back up folder so next time it disappears I can see it happen, but still have my tabs I hope.

0 Likes
Message 16 of 30

brian.kramer
Alumni
Alumni

I believe I know what the problem is and I'm working on a solution.

For the time being, saving/restoring of the Script Editor tabs works best if the Script Editor has been open at some point during your Maya session.

 


Brian Kramer
Software Developer
Message 17 of 30

malcolm_341
Collaborator
Collaborator

Oh good to know, I'll try closing it while working today and see what happens.

0 Likes
Message 18 of 30

malcolm_341
Collaborator
Collaborator

@brian.kramerokay so I just opened the script editor today and all my tabs are gone. As you suggested I worked in Maya for a couple hours yesterday without opening the script editor, I closed Maya and everything looked fine in the scriptEditorTemp folder. Today I worked for 20 minutes in Maya and then opened the script editor using the icon near the bottom of Maya. Upon opening my tabs are gone, here's a screenshot.

 

So the scriptEditorTabPrefs.txt has reverted itself to default. The commandExecutor files appear to be saved, but here's the gotcha of this bug when I close the script editor in 2022.2 it automatically runs the new tabs save feature and I lose all my work. So not only is there a bug that you lose your tabs, but by design the tabs feature destroys your backup leaving you with nothing next time you open the script editor.

 

malcolm_341_0-1638305363184.png

 

Message 19 of 30

brian.kramer
Alumni
Alumni

Sorry for the misunderstanding, but what I was trying to say was for every session of Maya you should also open the Script Editor. You can close it afterwards if not needed but if you leave it open then Maya will automatically open it  the next time you run Maya. The important part is the Script Editor is opened each time you run Maya.

 

Specifically,

- Run Maya

- Immediately open the Script Editor.

- Leave it open and it will be reopened next time you run Maya. Or close it, just be sure to open it next time you run Maya.

- Model, animate, render, repeat.

- Quit Maya

- Back to the first step.


Brian Kramer
Software Developer
Message 20 of 30

malcolm_341
Collaborator
Collaborator

Can I open it via a mel script, or do I need to use the UI?

0 Likes