I am trying to write a script that successfully selects all of the text in the MEL scripting editor, saves it and then sources it. There are some extra conditions, I want it to be automatically saved into the user's maya/2008/scripts, I do not want a save menu to appear at all.
What I have thus far brings up a simple window with a text area and a button. Clicking the button should save the file in the correct folder and then source the script. I cannot however find a way to save without pulling up the save dialog window.
CODE
if ( window -exists ssWindow ){
deleteUI ssWindow;
}
else{
window -h 200 -w 500 -t "Save/Source" "ssWindow";
columnLayout;
text "Enter script name";
textField -w 300 -ec showInput userIn;
button -align "right" -command showInput "Save/Source";
showWindow;
}
proc showInput(){
string $userInput = textField -q -tx userIn;
string $fileExt = getCurrentExecuterTabType;
delegateCommandToFocusedWindow ("-e -saveSelection" + $userInput + $fileExt);
print $userInput;
}
I'm aware I haven't included the sourcing part of the script, right now I'm just focused on getting it to save itself without using the extra window.