2012-12-21, 21:26
(2012-12-18, 20:47)sudopinion Wrote:(2012-12-18, 20:20)harSon Wrote: It starts, but not because of the batch script. I only starts because I have it set to start upon Windows starting, but when I take that away in the program's settings, it fails to boot up when I launch the batch file.
This is an AutoHotkey script that will do what you're looking to do, but seriously, look into Rom-Jacket. It's built to do this kind of stuff.
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")
}
Run, "C:\program files (x86)\xpadder\xpadder.exe" /m controller1.xpadderprofile controller2.xpadderprofile
Runwait, "C:\Program Files (x86)\Activision\Call of Duty Black Ops II\t6sp.exe" "%1%"
Process_Resume("xbmc.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)
}
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!
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")
}
Run, "C:\Xpadder\xpadder.exe" /m controller1.xpadderprofile controller2.xpadderprofile
Runwait, "C:\Program Files (x86)\Activision\Call of Duty Black Ops II\t6sp.exe" "%1%"
Process_Resume("xbmc.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)
}