2012-12-22, 00:36
(2012-12-21, 21:26)harSon Wrote: Hey, I need help with this script you posted. I managed to get things working before, but my XBMC was corrupted and I had to redo everything. This is the only thing I can't get to work again. XBMC minimizes and the game launches, but I get an error from Xpadder saying the controller cannot be opened. Any ideas? Also, if possible, I'd like to put in a command to suspend/kill eventghost when the game is started and resume/start eventghost when I exit the game, since the program messes with my video game controls.
The path to my eventghost is C:\Program Files (x86)\EventGhost\eventghost.exe
Thanks!
No problem.
The reason you get the xpadder issue is because it is trying to load controller1.xpadderprofile & controller2.xpadderprofile which don't exist in your "C:\Xpadder" directory.
Follow these steps:
1: For the xpadder issue, create a profile with no mapped keys. Name it nolayout1.xpadderprofile & save it in "C:\xpadder".
(this will clear the xpadder keys when you quit the game. You may choose to remap this layout to something that will control xbmc if you're feeling fancy.)
2: Make or rename the blackops xpadderprofile to CODBO2.xpadderprofile and put it in your "C:\xpadder" directory.
3: Ajust the script with the following changes to fix the xpadder issue and enable eventghost suspension:
Code:
#NoEnv
#Singleinstance force
DetectHiddenWindows, On
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 3
Autotrim, off
MouseMove, 9999,-9999
WinHide, ahk_class Shell_TrayWnd
WinHide, Start ahk_class Button
WinMinimize, XBMC
Process, Exist, xbmc.exe
xbmc_pid=%errorLevel%
If (xbmc_pid = 0)
{
{
If ! errorLevel
{
}
}
}
else
{
Process_Suspend("xbmc.exe")
Process_Suspend("EventGhost.exe")
}
Run, "C:\Xpadder\xpadder.exe" /m CODBO2.xpadderprofile
Runwait, "C:\Program Files (x86)\Activision\Call of Duty Black Ops II\t6sp.exe" "%1%"
Run, "C:\Xpadder\xpadder.exe" /m nolayout1.xpadderprofile
Process_Resume("xbmc.exe")
Process_Resume("EventGhost.exe")
WinShow, ahk_class Shell_TrayWnd
WinShow, Start ahk_class Button
WinRestore, XBMC
exitapp
esc::
exit
ProcExist(PID_or_Name=""){
Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
Return Errorlevel
}
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)
}
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)
}
...