AutoHotkey Community

It is currently May 27th, 2012, 10:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: December 6th, 2006, 9:40 pm 
Offline

Joined: December 6th, 2006, 9:38 pm
Posts: 3
Hi, I am trying to create a script which will dim the screen, but unlike all of the scripts I am coming across here, I need to be able to click through the transparent GUI that is being used to cause the dimming effect. Is this possible?

Any help with this will be much appreciated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2006, 2:14 am 
Offline

Joined: July 6th, 2004, 10:07 am
Posts: 171
Location: Manchester, England.
@ hccdmatt

1. short answer NO

2. long answer

WINSET sets either transparency and/or transcolor. If I remember correctly you cannot click through any level of transparency but, if you select a color for transcolor then that region will be clickthrough which basically defeats what your trying to achieve

QED.

Regards.

_________________
Simple ideas lie within reach, only of complex minds


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2006, 8:54 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
I am unsure of the relevancy of this post, but:

Adjusting Brightness with mouse scroll button is possible with this tool : Volumouse 76.4k

:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on December 7th, 2006, 6:36 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2006, 4:47 pm 
Offline

Joined: December 6th, 2006, 9:38 pm
Posts: 3
The system which I am trying to dim the screen of has no mouse, as it is a touchscreen. Let me explain the situaltion. This is a computer system that will be mounted inside a vehicle. The pc controls a video monitoring system, which the touchscreen allows the user to operate the control software of the camera. As of right now the only way to dim the screen at night to retain night vision is for the operator to use the menu buttons of the screen to manuall dim it. I have checked with the manufacturer and their drivers do not support any key combinations or other input to change brightness through the PC.

~edit:

I am not sure what I was thinking... I am going to try that program and simulate mouse wheel moves with a script and see if that gets me what im looking for, thanks.


~edit:

Well the video hardware in the PC does not support the gamma function that software uses to dim the screen, so I guess I am back to square 1 lol.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: dim the app
PostPosted: December 8th, 2006, 4:39 am 
Offline

Joined: December 20th, 2005, 4:15 am
Posts: 165
Location: Malaysia
Assuming you're on win2K or XP, I think this is doable.

You could set the desktop background to solid black, then just adjust the transparency of your app using WinSet.

Since the background is black, this has a nett effect of dimming. Adjust as required:

Code:
WinSet, Transparent, 200, Untitled - Notepad
; Make the window a little bit transparent.


With a bit of work, you could even write an adjustable dimmer script just for your app.

-Lemming


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 8th, 2006, 3:53 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Lemming's idea looks the best, but you could also put a semi-transparent GUI always on top. This window will receive the touch-screen events (mouse clicks) and then sends them to the application underneath, with, e.g. ControlClick.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2006, 8:26 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Here is a simple script for the transparent cover:
Code:
Gui Color, 0,0                     ; Black
Gui -Caption +ToolWindow +E0x20    ; No title bar, No taskbar button, Transparent for clicks
Gui Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight% ; Create a semi-transparent cover window
WinGet ID, ID, A                   ; ...with HWND/handle ID

Winset AlwaysOnTop,ON,ahk_id %ID%  ; Keep it always on the top
WinSet Transparent,99,ahk_id %ID%
It covers everything with a semi transparent window, so the screen looks dimmed. Only the taskbar pops up in full intensity, if you click on something. To prevent that, another transparent window could be created, which is docked to the taskbar (add to the end of the other script).
Code:
Gui 2:Color, 0,0                   ; Black
Gui 2:-Caption +ToolWindow +E0x20  ; No title bar, No taskbar button, Transparent for clicks
Gui 2:Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight% ; Create a semi-transparent cover window
WinGet ID, ID, A                   ; ...with HWND/handle ID

Winset AlwaysOnTop,ON,ahk_id %ID%  ; Keep it always on the top
WinSet Transparent,99,ahk_id %ID%

WinGet hw_tray, ID, ahk_class Shell_TrayWnd
DllCall("SetParent", UInt,ID, UInt,hw_tray) ; dock cover window to the taskbar
You could modify the dimensions of the cover windows, so they don't overlap. Left to the reader as an easy exercise.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 16th, 2011, 6:00 pm 
Offline

Joined: June 29th, 2011, 5:15 pm
Posts: 7
@Laszlo: Awesome. Thank you. Thank you. Thank you. Thank you.

I needed a FAST solution to dimming both monitors (migraine light sensitivity), and this plus a monitor loop equals 97% solution.

The other 3% are the windows that still "on top" the dimmer windows:
    Taskbar (even with the second snippet)
    Context menus
    Drag images (drag-n-drop "previews," etc)
    Windows Spy



This thread http://www.autohotkey.com/forum/topic66640.html refers around to other solutions, but none of them cover the last 3%.

Any one? PLEASE????


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2011, 6:23 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
You can try a timer loop to constantly set the cover window on top of others:
Code:
Gui Color, 0,0                     ; Black
Gui -Caption +ToolWindow +E0x20    ; No title bar, No taskbar button, Transparent for clicks
Gui Show, X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight% ; Create a semi-transparent cover window
WinGet ID, ID, A                   ; ...with HWND/handle ID
SetTimer OnTop, 1

OnTop:
Winset AlwaysOnTop,ON,ahk_id %ID%  ; Keep it always on the top
WinSet Transparent,99,ahk_id %ID%
Only the script's own context menu and status window is not dimmed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2011, 9:13 pm 
Offline

Joined: June 29th, 2011, 5:15 pm
Posts: 7
Tried the timer loop. I forget why, but it wasn't quite right... Maybe it was still missing various things. The loop time has to be really small, or else you get a flicker.

I had been trying to catch everything based on events. I'm missing some event coverage... or there are not events (still trying to sort that out).

Here's my current. It's multi-monitor, since I have 2 at work. It's not pretty (there is dead code, fyi), but it works... just not with every possible thing that will jump to the top.


Code:
WinGet hw_tray, ID, ahk_class Shell_TrayWnd

dimmerLevel=100

SysGet, nMon, MonitorCount
hwndlist=
msg=
Loop, %nMon% {
    SysGet pos, Monitor, %A_Index%

    guiNum := A_Index ; + 1
    Gui %guiNum%:Default
    Gui Color, 0,0                     ; Black
    Gui -Caption +ToolWindow +AlwaysOnTop +E0x20 +E0x20000000  ; No title bar, No taskbar button, Transparent for clicks

    width := posRight - posLeft
    height := posBottom - posTop
   
    Gui Show, X%posLeft% Y%posTop% W%width% H%height% ; Create a semi-transparent cover window
    WinGet ID, ID, A                   ; ...with HWND/handle ID
    hwndlist%guiNum%= %ID%
   
;     Winset AlwaysOnTop, ON, ahk_id %ID%  ; Keep it always on the top
    WinSet Transparent, %dimmerLevel%, ahk_id %ID%

;     tmp=%A_Index%: X%posLeft% Y%posTop% W%width% H%height%
;     msg .= tmp "`n"
}

; MsgBox, , Monitor Listing, %msg%

; Event response to keep windows on top.
;     Gui +LastFound
;     hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt, ID )
MsgNum := DllCall( "RegisterWindowMessage", Str, "SHELLHOOK")
OnMessage( MsgNum, "WinActivated_Handler")

DllCall("CoInitialize", Uint, 0)
HookProcAdr := RegisterCallback( "WinEventHookProc", "F" )
hookWinEvent := DllCall("SetWinEventHook"
              , Uint, 0x6, Uint, 0x9
              , Uint,0, Uint,HookProcAdr
              , Uint,0, Uint,0, Uint, 0)

; SetTimer OnTop, 50
return
;----------------------------------

OnTop:
        Loop, %nMon% {
     ID := hwndlist%A_Index%
      Winset AlwaysOnTop, ON, ahk_id %ID%  ; Keep it always on the top

    Winset AlwaysOnTop,ON,ahk_id %ID%  ; Keep it always on the top
    WinSet Transparent,%dimmerLevel%,ahk_id %ID%
         }
    return

WinActivated_Handler( lParam, wParam ) {
;     TrayTip, , % "WinAct: " lParam ", " wParam, 2

    if (lParam = 4) {
        ReTop(wParam)
    }
}

WinEventHookProc( hWinEventHook, Event, hWnd, idObject, idChild, dwEventThread, dwmsEventTime )
{
;    TrayTip, , % "WinEvt: " hWnd ", " Event, 2

   ReTop(hWnd)   
}

ReTop(hWnd) {
    global hw_tray, hwndlist, dimmerLevel, nMon

    if (hWnd = 0)
        hWnd := hw_tray

;     TrayTip, , %hWnd%, 2

    Loop, %nMon% {
        ID := hwndlist%A_Index%
   
        Winset AlwaysOnTop,ON,ahk_id %ID%  ; Keep it always on the top
        WinSet Transparent,%dimmerLevel%,ahk_id %ID%
     }

}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, HotkeyStick and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group