//SaveNotifier // // Date: 2004/03/2 // Author: Dai Sato dstruevision@dstruevision.com http://www.dstruevision.com // Procedure Name: SaveNotifier // // Description: This scripts notify you of saving time at intervals you set. // And it ask you whether you want to save scene or not. // How to use: Type SaveNotifer in command line, then press enter. // Just by pressing start button, it starts working and you can close this scripts window. // When you wanna stop this scripts, open this scripts window by typing SaveNotifier again // then press stop button. // After you changed interval value, you have to press start button again. // If a waning like this happens "Warning: line 1: The specified scriptJob (821) does not exist.", and // can't stop this script, then plz save your scene manually and restart Maya. global proc checkElapsedTime() { global float $startTime; global int $checkIntervalField; $myInterval = $checkIntervalField*60; $elapsedTime = `timerX -startTime $startTime`; print ("Total Time: "+$elapsedTime+"\n"); if($elapsedTime>$myInterval) { $checkAnswer = `confirmDialog -title "Confirm" -message "You wanna save scene?" -button "Yes" -button "Not Now" -defaultButton "Yes" -cancelButton "No" -dismissString "No"`; if($checkAnswer=="Yes"){ SaveScene; } $startTime = `timerX`; } } global proc jobStarter() { global int $jobNum; global int $checkIntervalField; $checkIntervalField = `intField -q -v intervalField`; $jobNum = `scriptJob -ct "busy" "checkElapsedTime()"`; } global proc SaveNotifier (){ global float $startTime; if ((`window -ex SaveNotifier`) == true) deleteUI SaveNotifier; window -t "SaveNotifier" -s false SaveNotifier; columnLayout -rs 10 mainColumn; rowColumnLayout -numberOfRows 1; text -label " Interval(minutes)"; intField -minValue -1 -maxValue 100 -value 1 intervalField; setParent mainColumn; rowColumnLayout -numberOfRows 1; button -l "Start" -w 50 -h 30 -c "jobStarter()"; button -l "Stop" -w 50 -h 30 -c "scriptJob -kill $jobNum"; window -e -width 200 -height 100 SaveNotifier; showWindow; $startTime = `timerX`; }