AutoHotkey Community

It is currently May 24th, 2012, 1:41 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: December 5th, 2006, 9:45 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
I want change in my function the current process priority, but after that, restore the original process it has before calling the function.
  1. starting a program
  2. retrieve and backup current programs priority
  3. change of priority
  4. at end of function, restore programs original priority

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2006, 10:00 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
There isn't a way (that I know of) to do that with pure AutoHotkey code, but there might be an obscure DllCall or SendMessage that would accomplish it. Why do you need to restore the original priority?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2006, 10:49 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
In my function I need to raise temporary the priority at specific position only, if needed. The function lies in a library which I include it on other scripts and don't want to change the priority of that script. It should be independent from the script which call the function.

Why don't support AutoHotkey this? May be this thread could be moved to the Wish List area?

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2006, 11:13 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
It's already planned, but I don't know when it will be implemented.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2006, 4:14 am 
@ tuncay

As jonny said a dll would be the obvious route as in (GetPriorityClass)
also an additionl CMD in Process command as in (GetPriority).
However if you're happy with using the cli processor then the following code will provide a solution

Code:

; 1. starting a program
run my prog.exe
; ====================================================
; 2. retrieve and backup current programs priority
RunWait, %comspec% /c pv "my prog.exe" -e -q > process.dat, ,hide
fileread,s,process.dat
Loop, Parse, s, %A_Tab%
{
fld%a_index% := a_loopfield
}
; process := fld1 lauchPath := fld4
proc_id  := fld2
priority := fld3
; =====================================================
; 3. change of priority
Process, priority, %proc_id%, H
; =====================================================
; 4. at end of function, restore programs original priority
RunWait, %comspec% /c pv "my prog.exe" -p%priority%, ,hide
; =====================================================


The neat little proggy can be downloaded @
http://www.teamcti.com/pview/prcview.htm
and download the COMMAND LINE version

Have FUN :lol:


Mod: Removed duplicate posting.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2006, 4:36 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Tuncay wrote:
2. retrieve and backup current programs priority


I had posted a function for that: GetPriority()


:(

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2006, 10:15 am 
Offline

Joined: July 6th, 2004, 10:07 am
Posts: 171
Location: Manchester, England.
@Goyyah

Well done sir, That's exactly the way it should be done!

Regards

_________________
Simple ideas lie within reach, only of complex minds


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2006, 10:38 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Dippy46 wrote:
That's exactly the way it should be done!

Thanks! :D

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Exabot [Bot], jyloup, TedStriker and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group