2 replies [Last post]
Serca's picture
User offline. Last seen 3 days 8 hours ago. Offline
Joined: 02/03/2020
Groups: Go Science

I would like to remind you that using external hotkey tools with foldit can be very useful.

Here are 2 simple examples of autohotkey scripts.

1) Logging output window and watching the output log with one hotkey.
Build-in output window isn't that handy on long recipes. Pressing Ctrl+q copies current system scriptlog file and opens it, so you could watch to the whole recipes' output log). Copied files are renamed according to script types that are running (drw, worm, etc..) and current time according to template:

scriptlog.20200323.2229.Worm.txt
scriptlog.20200325.0409.DRW.txt
scriptlog.20200325.2059.GAB.txt

Code:

~^q::
FormatTime, CurrentDate,,yyyyMMdd
FormatTime, CurrentTime,,HHmm
Clpbrd := CurrentDate . "." . CurrentTime

; check for different script types to write it to filename
type:=""
FileReadLine, scriptName, E:\Games\Foldit\scriptlog.default.xml, 4
If InStr(scriptName, "DRW")
type:="DRW"
If InStr(scriptName, "Remix")
type:="Remix"
If InStr(scriptName, "GAB")
type:="GAB"
If InStr(scriptName, "Cut")
type:="Cut"
If InStr(scriptName, "Helix")
type:="Helix"
If InStr(scriptName, "Worm")
type:="Worm"
If InStr(scriptName, "Tweek")
type:="Sidechain"
If InStr(scriptName, "Sidechain")
type:="Sidechain"

Clpbrd := "E:\Games\Foldit\scriptlog." . Clpbrd . "." . type . ".txt"
; MsgBox %Clpbrd%

FileCopy, % "E:\Games\Foldit\scriptlog.default.xml", % Clpbrd
Run % Clpbrd
Sleep 200
Send, {ctrl down}{end}{ctrl up}

return

----
It is useful to [partially] log the recipes you run in foldit.

You can run that script using autohotkey, just don't forget to change the path from "E:\Games" to correspond to your foldit folders.

Serca's picture
User offline. Last seen 3 days 8 hours ago. Offline
Joined: 02/03/2020
Groups: Go Science
Saving solution with ONE key.

This script works when foldit window is active. If Ctrl+s is pressed it saves the current solution with the name of current date and time, clicking to all the "OK" dialogs:

20200323-0323
20200318-0102
20200323-2017

Here is the code:

~^s::
if WinActive("ahk_exe Foldit.exe")
{
FormatTime, CurrentDate,,yyyyMMdd
FormatTime, CurrentTime,,HHmm
Clipboard := CurrentDate . "-" . CurrentTime
Sleep, 200
SendInput, {Ctrl Down}{v}{Ctrl Up}
Sleep, 200
SendInput, {Enter}
Sleep, 200
SendInput, {Enter}
}
return

It replaces standard foldit Ctrl+s hotkey.

Serca's picture
User offline. Last seen 3 days 8 hours ago. Offline
Joined: 02/03/2020
Groups: Go Science
Pause foldit on F10

This script suspends/resumes foldit.exe process when F10 key is pressed. Allows to pause any script that is executed in Foldit and resume it right from the place it was stopped.
Code:

Process_Suspend(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtSuspendProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}

Process_Resume(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtResumeProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}

ProcExist(PID_or_Name=""){
Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
Return Errorlevel
}

WinGet, ActivePid, PID, A
; Suspend the process
; Process_Suspend(ActivePid)

F10::
if ispaused=0
{
Process_Suspend("Foldit.exe")
ispaused=1
}
else
{
Process_Resume("Foldit.exe")
ispaused=0
}
return

---
Unfortunately if you activate Foldit window while the process is suspended the application freezes. So press F10 only when Foldit is minimized and don't forget to resume it before activating Foldit window.

Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons