FoldWise

Here you can find out about our Folding Team! Our goal: to understand protein folding, protein aggregation, and related diseases
Post Reply
User avatar
Alathald
Legit Extremist
Legit Extremist
Posts: 1630
Joined: Sun Dec 17, 2006 11:55 pm
Location: Southern Ohio
Contact:

FoldWise

Post by Alathald »

I just came across a little vB script (from a mac forum no less) that can stop the FAH Process when a certain process from a list starts up (say a game) and start folding again once the process shuts down. I've been messing around with it a little trying to get it to work but no go so far. It's been awhile since my vB class though so it's a bit hazy and vB script is a slightly different beast anyway so I'm hoping someone on the forums is a little more versed and can figure out how to get it working. The coding is not the best in the world (the author is from a mac forum :) ) but I don't see why this can't be made to work. It would be a nice little script that would make folding on a gaming rig slightly less, dare I say, annoying.

It's getting kinda late so I'm going to bed but I don't see why this can't be made to work easily. Anyway, here's the code and links: http://www.teammacosx.com/forum/cgi-bin ... f=3;t=1893
filename (it references its self): GetProcess.vbs

Code: Select all

On Error Resume Next
Dim strServer, executable

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set objFS = CreateObject("Scripting.FileSystemObject")

' Get Name of Input File and Check to see if its valid
strInputFile = "c:\GetProcess\list.txt"

Set processList = objFS.OpenTextFile (strInputFile)

If strInputFile = "" Then
   MsgBox ("Operation Cancelled, no input file supplied")
   Wscript.Quit(1)
ElseIf Err Then
   ErrMsg = AdsiErr(strInputFile)
   MsgBox ("Error: "& ErrMsg)
   Wscript.Quit(1)
End if  

do while processList.AtEndOfStream <> True
  executable = ProcessList.ReadLine
  Dim DoTheLoop
'strComputer = "."
' The service name is the last word after the / in this line.
Set FoldingServiceObj1 = GetObject("WinNT://./F@H1")
'Set FoldingServiceObj2 = GetObject("WinNT://./F@H2")
'Set FoldingServiceObj3 = GetObject("WinNT://./F@H3")
'Set FoldingServiceObj4 = GetObject("WinNT://./F@H4")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")

' Looking for the Process to be running.  This is Read from the list.txt file...
Do
'WScript.Echo "Beginning of Loop, DoTheLoop = " & DoTheLoop
DoTheLoop = 0
WScript.Echo executable
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & executable & "'")

' If the process is found the following happens and then the script loops until the process is done.
For Each objProcess In colProcessList
WScript.Echo "Process Found, Stopping Service"
   FoldingServiceObj1.Stop
   'FoldingServiceObj2.Stop
'FoldingServiceObj3.Stop
'FoldingServiceObj4.Stop
DoTheLoop = 1
'Sleep for Specified time in Milliseconds.  60000 = 60 seconds or 1 minute
Wscript.Sleep 10000
'WScript.Quit
Next
Loop While DoTheLoop = 1
Loop
' If the process is not found this happens and then the script quits
'WScript.Echo "Process Not Found, Exiting"
FoldingServiceObj1.Start
Set FoldingServiceObj1 = Nothing
'FoldingServiceObj2.Start
'Set FoldingServiceObj2 = Nothing
'FoldingServiceObj3.Start
'Set FoldingServiceObj3 = Nothing
'FoldingServiceObj4.Start
'Set FoldingServiceObj4 = Nothing

' Set a time to run the Script again.  After Soon.exe the number is in seconds, 60 = 1 minute.
Set objApp = CreateObject("WScript.Shell")
objApp.Run "cmd /C C:\GetProcess\Soon.exe 180 C:\GetProcess\GetProcess.vbs"  
Image
User avatar
stev
Legit Extremist
Legit Extremist
Posts: 1507
Joined: Thu Feb 16, 2006 7:29 am
Location: Nashville, TN suburbs
Contact:

Re: FoldWise

Post by stev »

With the XP/Vista GUI client, you can pause F@H before playing any heavy games. :)

As for the SMP client, I'm unsure what you need to do. :-k
AMD X2 TK-57 1.90Ghz | F700 Quanta | PC2-5300 DDR2 2Gb | GeForce 7000M | DVDRAM GSA-T40N | HP LaserJet 1018
My Stats http://folding.extremeoverclocking.com/ ... =&u=303718
Image
http://www.eff.org - Electronic Frontier Foundation - working to protect your digital rights
User avatar
Zertz
Legit Extremist
Legit Extremist
Posts: 1118
Joined: Tue Mar 20, 2007 4:19 pm
Location: Magog, Quebec

Re: FoldWise

Post by Zertz »

stev wrote:As for the SMP client, I'm unsure what you need to do. :-k
If the priority is set on low (by default it is) every other process will have it's instructions crunched before F@H so it doesn't have much of an effect on the game.
User avatar
Alathald
Legit Extremist
Legit Extremist
Posts: 1630
Joined: Sun Dec 17, 2006 11:55 pm
Location: Southern Ohio
Contact:

Re: FoldWise

Post by Alathald »

I meant this for running the console version as a service, just thought it'd be a nice little script to have if it was working, not needing to worry about having to pause FAH when you run your game, just knowing it was done for you. I'll keep messing with it a bit when I get tired of messing with my shiny new Ubuntu install but I'm not all that versed in vB script.

@Zertz - It's true that for most games, folding doesn't cause a problem but for some you get lag while running it so I usually just stop it before gaming.
Image
User avatar
stev
Legit Extremist
Legit Extremist
Posts: 1507
Joined: Thu Feb 16, 2006 7:29 am
Location: Nashville, TN suburbs
Contact:

Re: FoldWise

Post by stev »

Alathald wrote: ... folding doesn't cause a problem but for some you get lag while running it so I usually just stop it before gaming.

I do hear you about lagging when F@H is running. While playing Halo on-line, I tend to forget to pause F@H and my player freezes every now and then while in play. :| Mostly it's my fault for not remembering that F@H is running. SO ... If the SMP is running, you will need to do something indeed!
AMD X2 TK-57 1.90Ghz | F700 Quanta | PC2-5300 DDR2 2Gb | GeForce 7000M | DVDRAM GSA-T40N | HP LaserJet 1018
My Stats http://folding.extremeoverclocking.com/ ... =&u=303718
Image
http://www.eff.org - Electronic Frontier Foundation - working to protect your digital rights
Post Reply