Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   automating shutdowns after renders (https://simplymaya.com/forum/showthread.php?t=24959)

danotronXX 06-02-2007 01:06 AM

automating shutdowns after renders
 
Ive been doing a lot of overnight renders but most of my shots only take about 3 hours to finish. does anyone know how to set maya to shut down your computer right after the renders are done.

oh and one other thing, do any of you guys happen to have a lamborghini murcielago model or know a link where i can get one? I thought it wouldnt hurt to ask saving myself a couple days on modeling one.

thanks for your replies

cheers,

enhzflep 06-02-2007 10:03 AM

1 Attachment(s)
Can't help with the Lambo, I'm affraid. Nor can I tell you how to get maya itself to initiate the shutdown.

When I've got a render going overnight, I usually just go into the poweroptions in the controll panel and set my computer to go into standby mode after X number of hours, X obviously being larger than the time I reckon is needed. The advantage of stand-by as opposed to shut down is that if you cock-up the timing, Maya is still open and running when you turn your pc back on, and will continue from where it was.

The other way you can do it is to schedule a task to be run some time after you think the render would finish. I'd use the method myself, but have been spectacularly unsuccesful at getting a task to run at the scheduled time, always getting back a message that says the task could not be completed.

For the second option, you just need to schedule a task that is capable of shutting down a windowsXP pc. I've attached a file I use for just this purpose(turning the pc off, that is). I'd much prefer to double-click an icon on the desktop, than go through the whole rigmarole of Start->TurnOffComputer->Shutdown & all the mouse movement inbetween.

I've attached the file I use. Recompiled today to add an icon to it.

EDIT: No reason to increase traffic in case anybody wants the source, here it is, with the exception of the icon - just take a snapshop of the windows Shudown image and save as a 32x32 icon. Code created & compiled with OpenWatcom IDE v1.5.

Main.cpp
Code:

/* Simple code to turn off a WindowsXP based computer.

 Wednesday 7 Feb, 2007 - Simon (enhzflep)

 Based on code by Greg Van Loon - author of StartupManager
*/

#include <windows.h>


void EnableShutdownPrivileges()
{
        HANDLE token;
        TOKEN_PRIVILEGES privileges;

        if(!::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
                ::MessageBox(NULL, "ERROR: Unable to open process token.", "Error", MB_OK | MB_ICONERROR);

        ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &privileges.Privileges[0].Luid);

        privileges.PrivilegeCount = 1;
        privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

        ::AdjustTokenPrivileges(token, FALSE, &privileges, 0, (PTOKEN_PRIVILEGES)NULL, 0);
        if(::GetLastError() != ERROR_SUCCESS)
                ::MessageBox(NULL, "ERROR: Uanble to adjust token privileges.", "Error", MB_OK | MB_ICONERROR);
}

int APIENTRY WinMain(HINSTANCE _1,HINSTANCE _2,LPSTR _3,int _4)
{
 EnableShutdownPrivileges();
 ExitWindowsEx(EWX_SHUTDOWN, 0);
 return 1;
}

PowerOff.rc
Code:

ICON1 ICON "G:\\PowerOff.ico"

1 VERSIONINFO
FILEVERSION 2,0,0,1
PRODUCTVERSION 2,0,0,1
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "Comments", "This is a program designed to shut down Windows.\0"
            VALUE "Description", "Enhzflep 2007\0"
            VALUE "FileVersion", "1.0.0.1"
            VALUE "FileDescription", "Shuts down Windows\0"
            VALUE "InternalName", "PowerOff\0"
            VALUE "LegalCopyright", "Copyright \xA9 2007, Enhzflep\0"
            VALUE "OriginalFilename", "PowerOff.EXE\0"
            VALUE "ProductName", "PowerOff 1.1\0"
            VALUE "ProductVersion", "1.0.0.1\0"
            VALUE "License", "None Needed\0"
        END
    END
   
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409, 1252
    END
END


danotronXX 07-02-2007 01:37 AM

oh great! thanks for ur reply:beer:


All times are GMT. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018