Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Transparent and/or Always On Top


  • Please log in to reply
16 replies to this topic
System Monitor
  • Members
  • 508 posts
  • Last active: Mar 26 2012 05:13 AM
  • Joined: 09 Mar 2007
This little script just sets a windows transparency or tells it to be always on top. Can be useful while trying to watch a video and doing something else at the same time.
I am sure that someone already has a script exactly like this but I have not seen one and thought I would share.
I also plan to make windows "click-throughable".
Also has small ugly OSD

Alt-W: Decreases transparency
Alt-S: Increases transparency

Alt-A: Toggles always on top

Alt-X: Make active window clickthroughable
Alt-Z: Make window under the mouse cursor non-clickthroughable

#InstallKeybdHook
#SingleInstance force
/*
Hotkeys:
Alt-A: make window always on top

Alt-W: make window less transparent
Alt-S: make window more transparent

Alt-X: make window clickthoughable
Alt-Z: make window under mouse unclickthroughable
*/

!a::
WinGet, currentWindow, ID, A
WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
if (ExStyle & 0x8)  ; 0x8 is WS_EX_TOPMOST.
{
	Winset, AlwaysOnTop, off, ahk_id %currentWindow%
	SplashImage,, x0 y0 b fs12, OFF always on top.
	Sleep, 1500
	SplashImage, Off
}
else
{
	WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
	SplashImage,,x0 y0 b fs12, ON always on top.
	Sleep, 1500
	SplashImage, Off
}
return

!w::
WinGet, currentWindow, ID, A
if not (%currentWindow%)
{
	%currentWindow% := 255
}
if (%currentWindow% != 255)
{
	%currentWindow% += 5
	WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
}
SplashImage,,w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return

!s::
SplashImage, Off
WinGet, currentWindow, ID, A
if not (%currentWindow%)
{
	%currentWindow% := 255
}
if (%currentWindow% != 5)
{
	%currentWindow% -= 5
	WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
}
SplashImage,, w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return

!x::
WinGet, currentWindow, ID, A
WinSet, ExStyle, +0x80020, ahk_id %currentWindow%
return

!z::
MouseGetPos,,, MouseWin ; Gets the unique ID of the window under the mouse
WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
Return

TurnOffSI:
SplashImage, off
SetTimer, TurnOffSI, 1000, Off
Return


System Monitor
  • Members
  • 508 posts
  • Last active: Mar 26 2012 05:13 AM
  • Joined: 09 Mar 2007
:bump:
Added functionality where the window is clickthroughable. I will also take any feature requests into consideration!

saikyou
  • Members
  • 1 posts
  • Last active: May 27 2010 07:20 PM
  • Joined: 25 May 2010
Thanks, this seems useful.
I added:
IfWinActive, Program Manager
{
	return
}
after !w:: and !s:: because using these on the desktop would cause click through-able windows to become impossible (or at least difficult?)to make unclickthrough-able again.

I'm not sure if that was the best way to do it since I'm new to AHK.

  • Guests
  • Last active:
  • Joined: --
Little problem:
with Win7 after Standy and then Hibernation hotkeys are disabled...

  • Guests
  • Last active:
  • Joined: --

Little problem:
with Win7 after Standy and then Hibernation hotkeys are disabled...


Uhm, sorry. Forgot to specify I've modified original Alt+W/S -> #WheelUp/Down (Win+mouse wheel up/down)...

huzaifa
  • Guests
  • Last active:
  • Joined: --
8) Nice Idea

  • Guests
  • Last active:
  • Joined: --

8) Nice Idea


The problem is that won't work anymore after resume from idle Hibernation...

  • Guests
  • Last active:
  • Joined: --
No hopes for a fix/workaround? :(

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Welcome to the window-club. Currently, there is NiftyWindows, WinCtrl, Windows Warrior, and several other window management scripts going on/been created! ;)

  • Guests
  • Last active:
  • Joined: --

Welcome to the window-club. Currently, there is NiftyWindows, WinCtrl, Windows Warrior, and several other window management scripts going on/been created! ;)


They have the same bug: stop working after standby+hibernation, even if they're still running in background.

sal
  • Members
  • 35 posts
  • Last active: Jun 16 2013 06:39 PM
  • Joined: 19 Feb 2011
Guest wrote

They have the same bug: stop working after standby+hibernation, even if they're still running in background.


did you try my version? is a gui
http://www.autohotke...03a3a0e7e934b6f

why don't you try reloding the scripts it may solve the problem[/url]

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

Welcome to the window-club. Currently, there is NiftyWindows, WinCtrl, Windows Warrior, and several other window management scripts going on/been created! ;)


They have the same bug: stop working after standby+hibernation, even if they're still running in background.

This is a bug with AutoHotkey, not with the scripts. Reloading solves it instantly.

  • Guests
  • Last active:
  • Joined: --

Welcome to the window-club. Currently, there is NiftyWindows, WinCtrl, Windows Warrior, and several other window management scripts going on/been created! ;)


They have the same bug: stop working after standby+hibernation, even if they're still running in background.

This is a bug with AutoHotkey, not with the scripts. Reloading solves it instantly.


That's what I thought. The problem is deep inside AutoHotkey, unfortunately. Would be nice a bug-fix.

Raccoon
  • Members
  • 178 posts
  • Last active: Oct 06 2014 05:58 PM
  • Joined: 02 Jan 2008

Always On Top:  Reduced version.

 

Use WinKey+A  for Always-On-Top of Active Window.

 

#a::
  WinGet, ExStyle, ExStyle, A
  if (ExStyle & 0x8)  ; 0x8 is WS_EX_TOPMOST.
    Winset, AlwaysOnTop, off, A
  else
    WinSet, AlwaysOnTop, on, A
Return

 

OR, simply.

 

#a:: Winset, AlwaysOnTop, Toggle, A


Posted Image

Need help right away? Get live support on IRC.
Already have an IRC client installed? /join #ahk

nordanalt
  • Members
  • 51 posts
  • Last active: Mar 23 2013 03:05 PM
  • Joined: 22 Jan 2013

Hey! Here's a version that resets each modified window to its defaults on Exit (not always on top, non-click-through-able, nontransparent).