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,307 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,308 Views
29 Replies
Replies (29)
Message 21 of 30

brian.kramer
Alumni
Alumni

Certainly! Simply use the ScriptEditor run time command. That is the same command that is called when you click on the button in the Command Line or select Windows > General Editors > Script Editor.

Be careful not to call it too early in the Maya start up process, otherwise the Script Editor won't be ready.

Something like the following line in your userSetup.mel script might do the trick:

scriptJob -runOnce true -event PreFileNewOrOpened ScriptEditor;

Brian Kramer
Software Developer
Message 22 of 30

malcolm_341
Collaborator
Collaborator

Great, I wrote my script that backs up the contents of the folder to another folder and as part of that script it opens the script editor so hopefully I can just run that script after Maya starts using my shelf button to avoid the problem until a patch comes out.

0 Likes
Message 23 of 30

Hans_Redman
Advocate
Advocate
Agree.
That's what I'm doing now just keep the Script Editor open haven't got any problem with that. No losing tabs so far. I don't shut my PC just leave it on sleep mode. you shut it, you lose it. (PS: Just be careful with win10 auto-update will restart your PC)
Just keep saving your code somewhere on your PC you should be fine.
Message 24 of 30

malcolm_341
Collaborator
Collaborator

Even with my script I still lose my work all the time because in some situations it can back up the deleted files, I've started using the annoying work around of making the tabs file read only, this is such a pain because you can't easily add, remove, or rename tabs.

0 Likes
Message 25 of 30

brian.kramer
Alumni
Alumni

Hi Malcom,


I'm real sorry you're still having issues with this.

 

If you are comfortable modifying one of the installed Maya scripts then here is a code snippet that will fix the Script Editor tab issue.

 

  • In your install of Maya look for the file scriptEditorPanel.mel. It should be in the .../Maya2022.2/runTime/scripts/startup directory.
  • Open scriptEditorPanel.mel in a text editor.
  • Search for: global proc saveScriptEditorTabs(). Should be around line 232.
  • Right above that procedure insert the following:
proc int scriptEditorTabsNeedSaving() {
    string $types[] = getTabTypes();
    string $labels[] = getTabLabels();
    return size($types) > 0 && size($labels) > 0;
}
  • Lastly, inside of saveScriptEditorTabs() insert the following to be the very first statement in the procedure:
if (!scriptEditorTabsNeedSaving()) { return; }

 

Be sure to set aside any scripts you have that may interfere with saving the tabs.


Brian Kramer
Software Developer
Message 26 of 30

malcolm_341
Collaborator
Collaborator

I found a less invasive solution that works for me. In the userSetup.mel add this line evalDeferred "ScriptEditor"; so the script editor opens each time you open Maya, thus avoiding the bug and you can rename and add/delete tabs as much as you want. I've been using this method for a couple weeks without losing my work.

Message 27 of 30

nathan.guttridge
Explorer
Explorer

Hi,
This still seems to be an issue in Maya2022.3
Will use the workarounds for now.

 

N

Message 28 of 30

malcolm_341
Collaborator
Collaborator

The userSetup workaround is still working for me months later I haven't lost anything.

Message 29 of 30

agibli
Observer
Observer

Since it hasn't been posted here: This appears to be fixed in 2022.4.

Message 30 of 30

brian.kramer
Alumni
Alumni
That is true. The changes to fix the Script Editor went into 2022.4.

Brian Kramer
Software Developer
0 Likes