[EMAIL PROTECTED] wrote at 7/14/2006 9:29 AM: > Newbie question time again... I've been asked to set up a Perl script > to run at "lower priority" on Windows workstations. Can this be done? > How?
First thing when faced with any Windows-specific question is to look at the documentation for the various Win32:: modules. In this case, it looks like Win32::Process would contain what you need. On reading it myself, it seems the Win32::Process::GetCurrentProcessID() method would get your script's PID*, which you could pass to the module's Win32::Process::Open() method to create a process handle object. From there, call SetPriorityClass(THREAD_PRIORITY_BELOW_NORMAL) on that object, and it appears your script will then drop in priority. You can verify this in Windows' Task Manager, available by right-clicking on an empty area of the taskbar and selecting "Task Manager" from the pop-up menu. Again, all this is just from reading the docs, and I have no practical experience with this module. Give it a try and see if it does what you want. --Mark (wasn't that nicer than "RTFM"?) * The Perl special variable $$ would do the same thing, but the documentation notes that this doesn't work with scripts running in the Cygwin environment. Besides, since you're already doing Windows-specific manipulation of the script's process you might as well use what the module gives you. _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
