Edit: I can't get Precision XOC to load a profile (not settings, but a profile- like the profile number will be colored in) when it starts, started another thread to assess that issue. That thread is here:
https://forums.evga.com/6...t-starts-m2855953.aspx There is a way to get this done with profiles and global hotkeys. I am having trouble getting the program to start with a specific profile consistently, however (see edit above). I might make a better bit of code, but for now I have CTRL+F1 set as the global hotkey for profile 0 and CTRL+F2 as the global hotkey for profile 1 (the fans maxed out on manual profile).
This powershell script elevates itself and runs code that presses CTRL+F2 to switch profiles and kill Precision XOC (note the elevation part comes from this gentleman (
https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/)
The rub is that I currently have to show the program and select a profile for this to work because 1) XOC won't open a profile when it starts and I presume 2) Global hotkeys do not work unless a profile is loaded.
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
# We are running "as Administrator" - so change the title and background color to indicate this
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
$Host.UI.RawUI.BackgroundColor = "DarkBlue"
clear-host
}
else
{
# We are not running "as Administrator" - so relaunch as administrator
# Create a new process object that starts PowerShell
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
# Specify the current script path and name as a parameter
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
# Indicate that the process should be elevated
$newProcess.Verb = "runas"
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
# Exit from the current, unelevated, process
exit
}
# Run your code that needs to be elevated here
# Here is the powershell code that key presses CTRL+F2 (^ is for CTRL and {F2} is for F2) and kills the Precisionx_X64 process:
$wshell = New-Object -ComObject wscript.shell;
$wshell.SendKeys('^{F2}')
Get-Process PrecisionX_x64 | Stop-process
# Erase the # from next two lines to have a press key to continue at end I found this unnecessary do not put code below here to run
#Write-Host -NoNewLine "Press any key to continue..."
#$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
post edited by ee11vv22gg33aa44 - 2018/09/13 14:39:50