An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DeepMind
Posts: 271
Joined: 19 Jul 2016, 14:47

An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

22 Jul 2016, 11:21

I need an script that autohide the taskbar (win7) when you're in a program like (potplayer), but disable auto-hiding when you're not using potplayer.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

22 Jul 2016, 11:45

Try this:

Code: Select all

WinHide, ahk_class Shell_TrayWnd
; do stuff
MsgBox
WinShow, ahk_class Shell_TrayWnd
I hope that helps.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

22 Jul 2016, 12:25

In Win7 I need to hide the button too, check exact classNN with winspy.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

22 Jul 2016, 12:28

Btw, too auto hide you can have a timer that has an ifwinactive, if you don't want to use a hotkey.
sexy69
Posts: 125
Joined: 24 Jul 2016, 06:41

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

26 Jul 2016, 08:24

And how to do it in one file?

Code: Select all

If Unhide the taskbar <- ???
   WinHide, ahk_class Shell_TrayWnd
Else
   WinShow, ahk_class Shell_TrayWnd
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

28 Jul 2016, 08:30

This will hide the taskbar within a second after a program of your choise is activated.

Code: Select all

timeBetweenChecks:=1000 							; Check every 1000 ms.
hideWhenThisProgramIsActive:="notepad++.exe" 		; Change to your program.
SetTimer,autoHide,%timeBetweenChecks%
OnExit, showWhenExitApp

Esc::ExitApp ; Escape exit program at any time, and unhides the tray window.

autoHide:
	IfWinActive ahk_exe %hideWhenThisProgramIsActive%
		WinHide, ahk_class Shell_TrayWnd
	else
		WinShow, ahk_class Shell_TrayWnd		
return

showWhenExitApp:
	WinShow, ahk_class Shell_TrayWnd
	ExitApp
return

User avatar
rommmcek
Posts: 1480
Joined: 15 Aug 2014, 15:18

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

28 Jul 2016, 09:09

This saves resources:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force
SetBatchLines, -1
CoordMode, ToolTip, Screen
DetectHiddenWindows, on
DetectHiddenText, on

wParam := lParam := tPar := fPar := ""
Gui +LastFound

DllCall("RegisterShellHookWindow", UInt, WinExist())
OnMessage(DllCall("RegisterWindowMessage", Str, "SHELLHOOK"), "OnShellMessage")
 
OnShellMessage(wParam, lParam, tPar, fPar) {
	if wParam||lParam||tPar||fPar {
		sleep, 100
		IfWinActive, ahk_class Notepad    ; =======----------> change WinTitel or class to suits you
			WinHide, ahk_class Shell_TrayWnd
		else
			WinShow, ahk_class Shell_TrayWnd
	}
		wParam := lParam := tPar := fPar := ""
}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

28 Jul 2016, 10:50

rommmcek wrote:This saves resources:
Nice! I'm gonna save that for future use. (Just needs WinShow on exit.)
sexy69
Posts: 125
Joined: 24 Jul 2016, 06:41

Re: An script that autohide the taskbar (win7) when you're in a program like (potplayer)?

29 Jul 2016, 07:03

Both work, but which is better?

A new problem.
I exchanged it:
WinHide, ahk_class Shell_TrayWnd
on:
run "D: \ _ PROGRAMS \ Hide Folders \ (off) .exe"
and include:
WinShow, ahk_class Shell_TrayWnd
on:
run "D: \ _ PROGRAMS \ Hide Folders \ (on) .exe", ahk_class

Now the cursor is blinking at 1 second and shows that it is busy.
One could do something about it?

Code: Select all

timeBetweenChecks:=1000
ProgramActive:="AkelPad.exe"
SetTimer,auto,%timeBetweenChecks%
OnExit, hide(on)
Esc::ExitApp

auto:
   IfWinActive ahk_exe %ProgramActive%
;      WinHide, ahk_class Shell_TrayWnd
      run, "D:\_PROGRAMS\Hide Folders\(off).exe"
   else
;      WinShow, ahk_class Shell_TrayWnd
      run, "D:\_PROGRAMS\Hide Folders\(on).exe"

return

hide(on):
{
;   WinShow, ahk_class Shell_TrayWnd
   run, "D:\_PROGRAMY\Hide Folders\(on).exe", ahk_class
   ExitApp
}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, Rauvagol and 335 guests