IntelPowerGadget - How to minimize / Disable AlwaysOnTop Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by rc76 » 16 Oct 2021, 03:50

I have installed this monitoring app (because I cannot use AHK to operate on Task Manager, as it requires admin/UAC, and I don't know how to enable admin/UAC with AHK for it ...):

https://www.intel.com/content/www/us/en/developer/articles/tool/power-gadget.html

I have created the following script to Start/Minimize/Stop the app, but cannot make it to "minimize", or "disable AlwaysOnTop".

Code: Select all

; ------------------------------------------------------------------------------

#SingleInstance, Force ; Directly load without prompt of previous instance.

; ------------------------------------------------------------------------------

Gui, Main: Destroy
Gui, Main: +AlwaysOnTop
Gui, Main: Add, Text, x10, Test
Gui, Main: Show, x1000 y200
Return

GuiClose:
ExitApp

ESC::ExitApp

; ------------------------------------------------------------------------------

; App : Start / Show
1::
  IfWinExist, ahk_exe IntelPowerGadget.exe
  {
    WinActivate, ahk_exe IntelPowerGadget.exe
    WinGet, o_hWnd, ID, ahk_exe IntelPowerGadget.exe

    ; o_hWnd := WinExist("Trade-Ideas Pro AI")
    ; MsgBox, 48, , hWnd: %o_hWnd%, 1

    WinSet, AlwaysOnTop, Off, ahk_id %o_hWnd%
    WinSet, AlwaysOnTop, Off, ahk_exe IntelPowerGadget.exe
  }
  else
  {
    ; Process do not exist, Start the App
    RunWait, C:\Program Files\Intel\Power Gadget 3.6\IntelPowerGadget.exe

    WinActivate, ahk_exe IntelPowerGadget.exe
    WinGet, o_hWnd, ID, ahk_exe IntelPowerGadget.exe
    WinSet, AlwaysOnTop, Off, ahk_id %o_hWnd%
    WinSet, AlwaysOnTop, Off, ahk_exe IntelPowerGadget.exe
  }

return

; ------------------------------------------------------------------------------

; App : Hide
2::
  IfWinExist, ahk_exe IntelPowerGadget.exe
  {
    WinActivate, ahk_exe IntelPowerGadget.exe
    WinSet, AlwaysOnTop, Off, ahk_id %o_hWnd%

    WinMinimize, ahk_id %o_hWnd%
    WinMinimize, ahk_exe IntelPowerGadget.exe
  }
  else
  {
    ; Process do not exist, do nothing.
  }
return

; ------------------------------------------------------------------------------

; App : End
3::
  IfWinExist, ahk_exe IntelPowerGadget.exe
  {
    Process, Close, IntelPowerGadget.exe
  }
  else
  {
    ; Process do not exist, do nothing.
  }
return

; ------------------------------------------------------------------------------
Any suggestion will be truly appreciated!


rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by rc76 » 16 Oct 2021, 08:32

Code: Select all

WinMinimize, ahk_exe IntelPowerGadget.exe

Code: Select all

PostMessage, 0x0112, 0xF020,,, ahk_exe IntelPowerGadget.exe,  ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
Nothing happens for both of above methods.

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by mikeyww » 16 Oct 2021, 16:09

Instead of the whole script, try a single minimize command. Add the class to the WinTitle, and run the script as admin. In some "worst case" scenarios, it may also be possible to minimize a window by Send !{Space}n.

rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by rc76 » 16 Oct 2021, 21:36

@mikeyww Is there any chance you may know any hotkey like:

Code: Select all

Send !{Space}n.
That has the effect of right mouse click?

This app will show a menu of the following if clicked on right mouse:
00.png
00.png (5.11 KiB) Viewed 716 times
I have tried the following code, but it just can't get any right mouse menu to show:

Code: Select all

ControlClick,,ahk_exe IntelPowerGadget.exe,,RIGHT,1,U
ControlClick,,ahk_exe IntelPowerGadget.exe,,RIGHT,1,D

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by mikeyww » 17 Oct 2021, 05:10

I'm interested in knowing what happened with the previous testing. Try the following when your target window is active.

Code: Select all

F3::WinMinimize, A
You can also post a screenshot of your Window Spy, which shows the complete WinTitle.

rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by rc76 » 17 Oct 2021, 20:03

All the previous attempts and the last one didn't work out:

Code: Select all

WinMinimize, ahk_exe IntelPowerGadget.exe
====> Nothing happens

Code: Select all

PostMessage, 0x0112, 0xF020,,, ahk_exe IntelPowerGadget.exe,  ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
====> Nothing happens

Code: Select all

Send !{Space}n.
====> This showed up:
01.png
01.png (3.13 KiB) Viewed 659 times

Code: Select all

F3::WinMinimize, A
====> Nothing happens

The WindowsSpy is as follow:
00.png
00.png (68.25 KiB) Viewed 659 times
My current thinking is, try to use AHK to show the following menu (which can be shown if manually clicked right mouse button), so that I can than choose to disable "AlwaysOnTop", so other applications can be activated before it.
02.png
02.png (30.43 KiB) Viewed 659 times
Any recommendation how I can try to accomplish the above?

I have tried the following code, but it just can't get any right mouse menu to show:

Code: Select all

ControlClick,,ahk_exe IntelPowerGadget.exe,,RIGHT,1,U
ControlClick,,ahk_exe IntelPowerGadget.exe,,RIGHT,1,D

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop  Topic is solved

Post by mikeyww » 17 Oct 2021, 20:47

Code: Select all

GroupAdd, intel, ahk_exe IntelPowerGadget.exe
#IfWinExist ahk_exe IntelPowerGadget.exe
F3::
WinGet, state, MinMax
If (state = MINIMIZED := -1)
     WinRestore , ahk_group intel
Else WinMinimize, ahk_group intel
Return
#IfWinExist

rc76
Posts: 144
Joined: 07 Nov 2020, 01:45

Re: IntelPowerGadget - How to minimize / Disable AlwaysOnTop

Post by rc76 » 19 Oct 2021, 21:17

It worked like magic!

Thank you @mikeyww !

Post Reply

Return to “Ask for Help (v1)”