Jump to content

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

SmartBright - Custom screen brightness and eyesaver


  • Please log in to reply
10 replies to this topic
jpjazzy
  • Members
  • 800 posts
  • Last active: Dec 17 2014 07:22 AM
  • Joined: 16 Feb 2010
Download Link: SmartBright (Click to see code or right click, and save as, to run it)

Author: jpjazzy

Description:
SmartBright Automatically adjusts to certains times a day to save your eyes. Inspired by f.lux software, it adjusts the brightness of your screen based on the time of day and allows you to customize the brightness of your screen with a simple interface/hotkey layout. Designed to save your burning retina at certain times of the day, it is a great AutoHotkey alternative to f.lux.

I designed the original piece for someone in the help section and decided to post it in case anyone else found it useful.

If you find it useful or have any suggestions, post a comment.



Use:

Left Click + Mouse WheelDown - Adjust brightness down (darken)
Left Click + Mouse WheelUp - Adjust brightness up (brighten)
Esc - Exit application
+ GUI Controls


Screenshots:
[X][X]


Bugs:
I have noticed a few bugs with GUI-Hider and I will work on them, therefore improving this script also, in time.

Upates:


11/03/2011 - Release date



Code:

Settimer, GUI2AlwaysOnTop, 10 ; Keep gui 2 on top

SetBatchLines, -1

FormatTime, CurrentHour,, h
FormatTime, CurrentAMPM,, tt         ; Get the relavent time set
FormatTime, CurrentMinute,, m

If (CurrentHour >= 1 && CurrentHour <= 7 && CurrentAMPM == "AM") ; If the time is 1 AM - 7 AM [MORNING]
{
   Intensity := 150 ; Dim intensity 150
}
Else If (CurrentHour >= 7 && CurrentHour <= 10 && CurrentAMPM == "AM") ; If the time is 7 AM - 10 AM [MORNING]
{
   Intensity := 50
}
Else If (CurrentHour >= 10 && CurrentHour <= 12 && CurrentAMPM == "PM") ; If the time is 10 PM - 12 PM [Evening]
{
   Intensity := 150
}
else
   Intensity := 150 ; Set intesity to nothing if the time frame is anything different

Gui, 1: Default
Gui, Color, 0x000000 ; Color to black
Gui, +LastFound +AlwaysOnTop -Caption +E0x20 ; Click through GUI always on top.
WinSet, Transparent, %Intensity% ; Set intensity first based on the time of dday
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% ; Cover entire screen

Gui, 2: Default ; Generate the Autohide options GUI
Gui, Color, 0xC11B17
gui, Font, s12 bold underline C0xFFFFFF, Times New Roman
Gui, Add, Text, x22 y10 w190 h20 , Screen Luminosity Options
gui, Font, s12 norm C0x7E2817, Times New Roman
gui, Font, s10 bold C0x7E2917, Times New Roman
Gui, Add, CheckBox, x22 y30 w170 h20 Checked vOnOffToggle gEnDisCusLum, Enable custom luminosity
Gui, Add, CheckBox, x22 y50 w170 h20 Checked vAutoHideCheck gAutoHideCheck, Auto-Hide options window
gui, Font, s10 bold underline C0xFFFFFF, Times New Roman
Gui, Add, Text, x232 y20 w170 h20 , Luminosity intensity
gui, Font, s7 norm C0xFFFFFF, Times New Roman
Gui, Add, Slider, x232 y40 w130 h20 Range0-200 vIntensity gAdjustLum, %Intensity%
Gui, Add, Text, x350 y60 w10 h20 , +
Gui, Add, Text, x240 y60 w10 h20 , -
Gui, Add, Text, x362 y40 w30 h20 , MAX
Gui, Add, Text, x213 y40 w20 h20 , MIN
Gui, +NoActivate -Border +LastFound +AlwaysOnTop
Gui, Show, y0 Autosize
GUI_AutoHide("U", 2, 2000) ; Autohide using my previously written function
return

GUI2AlwaysOnTop:
Gui, 2: +AlwaysonTop
return

EnDisCusLum: ; Turn on off custom brightness
Gui, 2: Submit, Nohide
Gui, 1: Default
If (OnOffToggle = 1)
	Gui, Show
else
	Gui, Hide
return

AutoHideCheck: ; Turn on or off the autohide for GUI 2
Gui, 2: Submit, Nohide
If (AutoHideCheck = 1) ; Checked
	GUI_AutoHide("U", 2, 2000)
else
	GUI_AutoHide("U", 2, 2000, 5, 0)
return

AdjustLum:
Gui, 2: Submit, NoHide
Gui, 1: Default
Gui, +LastFound
WinSet, Transparent, %Intensity%
return

~LButton & WheelUp:: ; Turn up the brightness by dimming the GUI
If Intensity = 0 ; Return if intensity is nothing
   return
Intensity-=5
Gui, +LastFound
WinSet, Transparent, %Intensity%
return

~LButton & WheelDown:: ; Turn down the brightness by making the GUI more visible
If Intensity > 200 ; Return if intensity is greater than 200, since we don't want the screen to go black
   return
Intensity+=5
Gui, +LastFound
WinSet, Transparent, %Intensity%
return

Esc:: ; Shut down window
ExitApp



; =====================================================================================================================================================





; ================================================================ Previously written GUI-Hider ======================================================




; =====================================================================================================================================================
;                   Original Author: jpjazzy            Link: http://www.autohotkey.com/forum/viewtopic.php?p=485853#485853
; =====================================================================================================================================================
;   GUI_AutoHide(Hide direction, [Gui # to hide, Delay in milliseconds before hiding, Number of pixels to display while hidden (offset), Enabled/Disabled Flag])
; =====================================================================================================================================================
; Required parameters: Hide direction (LEFT="L", RIGHT="R", UP="U", DOWN="D")
; Defaults for optional parameters: GUI # = 1, Delay in ms = 3000 = 3 seconds, Number of pixels to display while hidden = 5, Enabled/Disabled Flag = 1 (Enabled=1 Disabled=0)
; =====================================================================================================================================================
; NOTES: 
; * Functions work with expressions, so make sure you use quotes when inputting settings unless the setting is contained within a variable
; * Function must be placed directly after the GUI you are using it for
; * Function will make the GUI AlwaysOnTop so the user can activate it from the autohide
; * Specifying 0 for the Enabled/Disabled Flag will return the GUI to it's original position before deactivating autohide
; * The window must be hidden and docked to the side of the screen before the effects of the autohide take place
; * The titlebar sometimes gets in the way of reactivating the hidden GUI if there is one... To get around this either remove the caption/border or Set a higher pixel offset
; =====================================================================================================================================================
; LIMITATIONS:
; - Using this on multiple GUIs most likely will cause problems due to the hide overlapping
; =====================================================================================================================================================
; ========================================= (AUTOHIDE FUNCTIONS) ==========================================
GUI_AutoHide(Hide_Direction, Gui_Num_To_Hide_Clone=1, Delay_Before_Hide=3000, Number_Of_Offset_Pixels=5, Enabled_Disabled_Flag=1) ; Autohide the GUI function
{
   global ; Assume global
   Gui_Num_To_Hide := Gui_Num_To_Hide_Clone
   Gui, %Gui_Num_To_Hide%: +LastFound ; Set GUI settings so we can obtain it's settings and give it an alwaysontop attribute to make the user be able to unhide it

   ; ** OBTAIN  AND SET VARIABLES **
   StringUpper, Hide_Direction, Hide_Direction ; Capitalize it just in case the user didn't for the label
   If ( Enabled_Disabled_Flag = 0 )
   {
   %Gui_Num_To_Hide%_Enabled_Disabled_Flag := 0
    WinMove, % %Gui_Num_To_Hide%_Gui_Title,, % %Gui_Num_To_Hide%_GUIX, % %Gui_Num_To_Hide%_GUIY
    return
   }
   
   WinGetPos, %Gui_Num_To_Hide%_GUIX, %Gui_Num_To_Hide%_GUIY, %Gui_Num_To_Hide%_GUIW, %Gui_Num_To_Hide%_GUIH, A
   WinGetTitle, %Gui_Num_To_Hide%_Gui_Title, A
   %Gui_Num_To_Hide%_TimeLapse := A_TickCount                           ; Set the specified variables with respect to which GUI the settings go to
   %Gui_Num_To_Hide%_Enabled_Disabled_Flag := Enabled_Disabled_Flag
   %Gui_Num_To_Hide%_Number_Of_Offset_Pixels := Number_Of_Offset_Pixels
   %Gui_Num_To_Hide%_Delay_Before_Hide := Delay_Before_Hide
   %Gui_Num_To_Hide%_Hide_Direction := Hide_Direction
    ;MsgBox % %Gui_Num_To_Hide%_Gui_Title
    
   
   ; ** Place message for GUI **
   OnMessage(0x200,"WM_MOUSEMOVE") ; Message to send when the mouse is over the GUI
   SetTimer, HideGUI%Hide_Direction%, 500 ; Set timer to hide the GUI in whatever direction you chose
   return
   
      ; ** HideGUI Settings **
   HideGUIU:
   ;~ ;MsgBox % "If (" A_TickCount - %Gui_Num_To_Hide%_TimeLapse " < " %Gui_Num_To_Hide%_Delay_Before_Hide ") "
   If (%Gui_Num_To_Hide%_Enabled_Disabled_Flag != 1)
      return
   If (A_TickCount - %Gui_Num_To_Hide%_TimeLapse < %Gui_Num_To_Hide%_Delay_Before_Hide)         ; If the mouse was over the GUI within the last 3 seconds, don't hide it
      return
   
      WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title ; Get the position of the GUI
      Loop
      {
         ; MsgBox % "If (" %Gui_Num_To_Hide%_GUIY+%Gui_Num_To_Hide%_GUIH " > " %Gui_Num_To_Hide%_Number_Of_Offset_Pixels ")"
         If (GUIY + %Gui_Num_To_Hide%_GUIH > %Gui_Num_To_Hide%_Number_Of_Offset_Pixels)     ; If the GUI is not hidden hide it then break
         {
            ;~ ;MsgBox % "WinMove,"  %Gui_Num_To_Hide%_Gui_Title ",, " GUIX ", " GUIY-(A_Index)
            WinMove, % %Gui_Num_To_Hide%_Gui_Title,, %GUIX%, % GUIY-(A_Index)
            WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title
            ;MsgBox % "WinGetPos,  " GUIX ", " GUIY ",,, "  %Gui_Num_To_Hide%_Gui_Title
         }
         else
            break
      }
   
   If ((GUIY + %Gui_Num_To_Hide%_GUIH) < (%Gui_Num_To_Hide%_Number_Of_Offset_Pixels-1)) ; Failsafe if the GUI moves too far
   {
      WinMove, % %Gui_Num_To_Hide%_Gui_Title,, %GUIX%, % (-%Gui_Num_To_Hide%_GUIH+%Gui_Num_To_Hide%_Number_Of_Offset_Pixels)
   }
   SetTimer, HideGUIU, OFF
   return
   
      HideGUID:
   ;~ ;MsgBox % "If (" A_TickCount - %Gui_Num_To_Hide%_TimeLapse " < " %Gui_Num_To_Hide%_Delay_Before_Hide ") "
      If (%Gui_Num_To_Hide%_Enabled_Disabled_Flag != 1)
      return
   If (A_TickCount - %Gui_Num_To_Hide%_TimeLapse < %Gui_Num_To_Hide%_Delay_Before_Hide)         ; If the mouse was over the GUI within the last 3 seconds, don't hide it
      return
   
      WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title ; Get the position of the GUI
      Loop
      {
         ; MsgBox % "If (" %Gui_Num_To_Hide%_GUIY+%Gui_Num_To_Hide%_GUIH " > " %Gui_Num_To_Hide%_Number_Of_Offset_Pixels ")"
         If (GUIY < A_ScreenHeight-%Gui_Num_To_Hide%_Number_Of_Offset_Pixels)     ; If the GUI is not hidden hide it then break
         {
            ;~ ;MsgBox % "WinMove,"  %Gui_Num_To_Hide%_Gui_Title ",, " GUIX ", " GUIY-(A_Index)
            WinMove, % %Gui_Num_To_Hide%_Gui_Title,, %GUIX%, % GUIY+(A_Index)
            WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title
            ;MsgBox % "WinGetPos,  " GUIX ", " GUIY ",,, "  %Gui_Num_To_Hide%_Gui_Title
         }
         else
            break
      }
   
   If (GUIY > A_ScreenHeight-(%Gui_Num_To_Hide%_Number_Of_Offset_Pixels-1)) ; Failsafe if the GUI moves too far
   {
      WinMove, % %Gui_Num_To_Hide%_Gui_Title,, %GUIX%, % (A_ScreenHeight - %Gui_Num_To_Hide%_Number_Of_Offset_Pixels)
   }
   SetTimer, HideGUID, OFF
   return
   
   HideGUIR:
      If (%Gui_Num_To_Hide%_Enabled_Disabled_Flag != 1)
      return
   ;~ ;MsgBox % "If (" A_TickCount - %Gui_Num_To_Hide%_TimeLapse " < " %Gui_Num_To_Hide%_Delay_Before_Hide ") "
   If (A_TickCount - %Gui_Num_To_Hide%_TimeLapse < %Gui_Num_To_Hide%_Delay_Before_Hide)         ; If the mouse was over the GUI within the last 3 seconds, don't hide it
      return
   
      WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title ; Get the position of the GUI
      Loop
      {
         ; MsgBox % "If (" %Gui_Num_To_Hide%_GUIY+%Gui_Num_To_Hide%_GUIH " > " %Gui_Num_To_Hide%_Number_Of_Offset_Pixels ")"
         If (GUIX < A_ScreenWidth-%Gui_Num_To_Hide%_Number_Of_Offset_Pixels)     ; If the GUI is not hidden hide it then break
         {
            ;~ ;MsgBox % "WinMove,"  %Gui_Num_To_Hide%_Gui_Title ",, " GUIX ", " GUIY-(A_Index)
            WinMove, % %Gui_Num_To_Hide%_Gui_Title,, % GUIX+A_Index, %GUIY%
            WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title
            ;MsgBox % "WinGetPos,  " GUIX ", " GUIY ",,, "  %Gui_Num_To_Hide%_Gui_Title
         }
         else
            break
      }
   
   If (GUIX > A_ScreenWidth-%Gui_Num_To_Hide%_Number_Of_Offset_Pixels) ; Failsafe if the GUI moves too far
   {
      WinMove, % %Gui_Num_To_Hide%_Gui_Title,, % A_ScreenWidth-%Gui_Num_To_Hide%_Number_Of_Offset_Pixels, %GUIY%
   }
   SetTimer, HideGUIR, OFF
   return
   
      HideGUIL:
   ;~ ;MsgBox % "If (" A_TickCount - %Gui_Num_To_Hide%_TimeLapse " < " %Gui_Num_To_Hide%_Delay_Before_Hide ") "
      If (%Gui_Num_To_Hide%_Enabled_Disabled_Flag != 1)
      return
   If (A_TickCount - %Gui_Num_To_Hide%_TimeLapse < %Gui_Num_To_Hide%_Delay_Before_Hide)         ; If the mouse was over the GUI within the last 3 seconds, don't hide it
      return
   
      WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title ; Get the position of the GUI
      Loop
      {
         ; MsgBox % "If (" %Gui_Num_To_Hide%_GUIY+%Gui_Num_To_Hide%_GUIH " > " %Gui_Num_To_Hide%_Number_Of_Offset_Pixels ")"
         If (GUIX+%Gui_Num_To_Hide%_GUIW > %Gui_Num_To_Hide%_Number_Of_Offset_Pixels)     ; If the GUI is not hidden hide it then break
         {
            ;~ ;MsgBox % "WinMove,"  %Gui_Num_To_Hide%_Gui_Title ",, " GUIX ", " GUIY-(A_Index)
            WinMove, % %Gui_Num_To_Hide%_Gui_Title,, % GUIX-A_Index, %GUIY%
            WinGetPos,  GUIX, GUIY,,, % %Gui_Num_To_Hide%_Gui_Title
            ;MsgBox % "WinGetPos,  " GUIX ", " GUIY ",,, "  %Gui_Num_To_Hide%_Gui_Title
         }
         else
            break
      }
   
   If (GUIX+%Gui_Num_To_Hide%_GUIW < %Gui_Num_To_Hide%_Number_Of_Offset_Pixels) ; Failsafe if the GUI moves too far
   {
      WinMove, % %Gui_Num_To_Hide%_Gui_Title,, % -%Gui_Num_To_Hide%_GUIW+%Gui_Num_To_Hide%_Number_Of_Offset_Pixels, %GUIY%
   }
   SetTimer, HideGUIL, OFF
   return
   
}


WM_MOUSEMOVE(wParam,lParam) ; Action to take if the mouse moves over the GUI
{
   If (%A_Gui%_Enabled_Disabled_Flag = 1)
   {
      RestartGUIActivate:
      LabelDir := %A_Gui%_Hide_Direction
      SetTimer, HideGUI%LabelDir%, Off ; Turn off the label while the mouse is over the GUI
      WinGetPos,  GUIX, GUIY,,, % %A_Gui%_Gui_Title ; Get the position of the GUI if your cursor is over it.
      
      ; DO ACTION BASED ON WHAT DIRECTION THE GUI IS SET TO
      If (%A_Gui%_Hide_Direction == "U")
      {
         Loop
         {
            If (GUIY+%A_Gui%_GUIH < %A_Gui%_GUIH) ; If the GUI is hidden, show it then break
            {
               WinMove, % %A_Gui%_Gui_Title,, %GUIX%, % GUIY+(A_Index)
               WinGetPos,  GUIX, GUIY,,, % %A_Gui%_Gui_Title
            }
            else
               break
         }
      }
      Else If (%A_Gui%_Hide_Direction == "D")
      {
         Loop
         {
            If (GUIY > A_ScreenHeight-%A_Gui%_GUIH) ; If the GUI is hidden, show it then break
            {
               WinMove, % %A_Gui%_Gui_Title,, %GUIX%, % GUIY-(A_Index)
               WinGetPos,  GUIX, GUIY,,, % %A_Gui%_Gui_Title
            }
            else
               break
         }
      }
      Else If (%A_Gui%_Hide_Direction == "R")
      {
         Loop
         {
            If (GUIX+%A_Gui%_GUIW > A_ScreenWidth+%A_Gui%_Number_Of_Offset_Pixels) ; If the GUI is hidden, show it then break
            {
               WinMove, % %A_Gui%_Gui_Title,, GUIX-A_Index, %GUIY%
               WinGetPos,  GUIX, GUIY,,, % %A_Gui%_Gui_Title
            }
            else
               break
         }
      }
      Else If (%A_Gui%_Hide_Direction == "L")
      {
         Loop
         {
            If (GUIX+%A_Gui%_Number_Of_Offset_Pixels < 0) ; If the GUI is hidden, show it then break
            {
               WinMove, % %A_Gui%_Gui_Title,, GUIX+A_Index, %GUIY%
               WinGetPos,  GUIX, GUIY,,, % %A_Gui%_Gui_Title
            }
            else
               break
         }
      }
      
      CoordMode, Mouse, Screen         ;get the mouse position in SCREEN MODE because your GUI is relative to the screen
      MouseGetPos, MX, MY
      CoordMode, Mouse, Relative
      If (%A_Gui%_Hide_Direction == "U" && MX >= %A_Gui%_GUIX && MX <= %A_Gui%_GUIX+%A_Gui%_GUIW && MY >= 0 && MY <= %A_Gui%_GUIH) ; Check if your mouse is still over the GUI (U)
      {
       goto, RestartGUIActivate  ;Restart if it is
      }
      Else If (%A_Gui%_Hide_Direction == "D" && MX >= %A_Gui%_GUIX && MX <= %A_Gui%_GUIX+%A_Gui%_GUIW && MY >= A_ScreenHeight-%A_Gui%_GUIH && MY-%A_Gui%_GUIH <= A_ScreenHeight) ; Check if your mouse is still over the GUI (D)
      {
       goto, RestartGUIActivate  ;Restart if it is
      }
      Else If (%A_Gui%_Hide_Direction == "R" && MX >= A_ScreenWidth-%A_Gui%_GUIW && MX <= A_ScreenWidth && MY >= %A_Gui%_GUIY && MY <= %A_Gui%_GUIY+%A_Gui%_GUIH) ; Check if your mouse is still over the GUI (R)
      {
       goto, RestartGUIActivate  ;Restart if it is
      }
      Else If (%A_Gui%_Hide_Direction == "L" && MX >= 0 && MX <= %A_Gui%_GUIW && MY >= %A_Gui%_GUIY && MY <= %A_Gui%_GUIY+%A_Gui%_GUIH) ; Check if your mouse is still over the GUI (L)
      {
       goto, RestartGUIActivate  ;Restart if it is
      }
      
      else ; If your mouse is not over the GUI, prepare to hide it.
      {
      %A_Gui%_TimeLapse := A_TickCount
      SetTimer, HideGUI%LabelDir%, 1000
      }
   }
}

AutoHotkey Basic - Windows 7
Posted Image

sesheron
  • Members
  • 9 posts
  • Last active: Jul 10 2014 06:56 PM
  • Joined: 07 Feb 2009
A program like wizmouse or custom scripts that send mouse wheels to windows being hovered over, over ride the hotkeys.

But otherwise I love it. I want to see how it goes through out the day, but I can already tell that it will save my eyes in the morning.

For the sake of minimalism, I use a script called OneIcon. So I turned the tray icon back on.
Also, to reduce the number of taskbar buttons, I added:
GUI, 1:+owner
GUI, 2:+owner
immediately after each GUI was first created. This will remove the task bar buttons completely. To keep just one, only do the GUI, 2:+owner one. This way the first gui still generates a taskbar button.


For those with multiple monitors, it only is applied to the main monitor.
To work on all monitors no matter the layout:
Replace:
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% ; Cover entire screen
With:
Sysget, Virtualwidth, 78
Sysget, Virtualheight, 79
Gui, Show, x0 y0 w%Virtualwidth% h%Virtualheight% ; Cover entire screen

I thought what I'd do was pretend I was one of those deaf-mutes.

jpjazzy
  • Members
  • 800 posts
  • Last active: Dec 17 2014 07:22 AM
  • Joined: 16 Feb 2010
Using the ~ modifier so the script does not intercept keys and making the wheels the second key should have solved this problem I thought? Is there and instance where it doesn't? I do know not everyone has a wheel mouse too though, which is why I threw in the GUI.

I am glad you like it. It only adjusts once, when you open it, as you can see by the if statements in the beginning. It makes the intensity of the black overlay 150 out of 255 during certain 'late' hours. It doesn't update after that, however that could be a nice check box addition to add. Something like 'Auto-adjust at all times" could be done using a set timer.

The owner button, great idea... I actually was going to do something about the task bar buttons, but wasn't sure what I should do. However, when I added the owner buttons, neither of the windows stopped showing on my task bar.

I don't have any experience with multiple monitors so I am sorry about that piece. It is an easy fix it seems. I suppose I could use:

SysGet, NumOfMon, MonitorCount

Then if the number is greater than 1, automatically use your code, and if not then use the built in variables for screen width/height.

Anyway, I am glad you liked the concept. I can see there is a lot to be done. I noticed with Aero though this causes some problems... If you have Aero on and 'auto-raise' some window, it will sear your eyeballs because it is shown over the top of the overlay, menus and the task bar seem to do the same thing. I can't think of any way around this. Any ideas? Also if anyone has better ideas on automatic adjustment or perhaps a formula on how to determine the intensity of the black overlay, I open to suggestions.

Things to work on:

[*:7r902jkb]Multi-monitor covering if statements to autocover them and a check box to turn that on or off.
[*:7r902jkb]Constant auto-adjust brightness check box.
[*:7r902jkb]Something to remove the windows from the taskbar? (Owner did not work for me...)
[*:7r902jkb]New hotkey for brightness adjustment? (Maybe)
[*:7r902jkb]A way to overlay things that make it over the top, such as auto-raised windows with Aero, menus, the tray, etc.
AutoHotkey Basic - Windows 7
Posted Image

sesheron
  • Members
  • 9 posts
  • Last active: Jul 10 2014 06:56 PM
  • Joined: 07 Feb 2009
+owner has to be added immediately after the gui is created otherwise it doesn't work.
So:
Gui, 1: Default
GUI, 1:+owner

Gui, 2: Default ; Generate the Autohide options GUI
GUI, 2:+owner

The method I used for multi monitors actually works just fine for one monitor. You could use it as default and never have to worry about it.

I was wrong about the intercepted mousekeys. That or the owner tag fixed it.

Unfortunately, I had to turn it off. While the method of using a transparent black window is ingenious, it caused visual glitches with autocad. I plan to keep looking at it and seeing if I can get those to stop.
I thought what I'd do was pretend I was one of those deaf-mutes.

Ranctifier
  • Guests
  • Last active:
  • Joined: --
The script has an error that occurs which prevents the gui from being shown at all, so I made this change:
Instead of:
52  Gui, +NoActivate -Border +LastFound +AlwaysOnTop

Change this to:
52  Gui, Show, NoActivate
53  Gui, -Border +LastFound +AlwaysOnTop
Note: The line "Gui, Show, NoActivate" is the same as "Gui, Show, +NoActivate".

All I have to say is that this is fantastic code.
Much easier to use than my monitor's controls.
I tend to use my computer late at night so this saves my eyes quite a bit of strain, kudos sir, kudos.

I added this line at the top to make the Gui move more quickly when it hides/shows itself. The 10 is a number that represents milliseconds, the default delay is 100, which I found to be far too slow for my use.
7  SetWinDelay 10


Everything else in this post is just personal tweaking of the script.

Edited the script slightly so it decides to show/hide itself a bit snappier, changed from the original 2000 to 500 millisecond delay.
56  GUI_AutoHide("U", 2, 500) ; Autohide using my previously written function

74  If (AutoHideCheck = 1) ; Checked
75  	GUI_AutoHide("U", 2, 500)
76  else
77	GUI_AutoHide("U", 2, 500, 5, 0)
78  return

Changed the rate at which the intensity increases and decreases, from the original 5 to 10.
90   Intensity-=10

98   Intensity+=10


gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
Very cool, i've been meaning to make a screensaver that acts differently daytime/nighttime

Try AnimateWindow to fade it into view (or move it like your function)

-gwarble

  • Guests
  • Last active:
  • Joined: --
hi there,

i really liked the ahk you created for controlling brightness. saved me tons of time going to nvidia control panel to adjust it (my monitor has no hardware controls).

would it be possible for me to customize it such that the GUI is removed? i just need the left mouse+scroll to control the brightness. how do i do it without destroying the code?

thanks!

  • Guests
  • Last active:
  • Joined: --

hi there,

i really liked the ahk you created for controlling brightness. saved me tons of time going to nvidia control panel to adjust it (my monitor has no hardware controls).

would it be possible for me to customize it such that the GUI is removed? i just need the left mouse+scroll to control the brightness. how do i do it without destroying the code?

thanks!


ditto - if possible, i would want it to launch in the background (i.e. no application icon nor tray icon), because pressing Esc at any point of time accidentally closes the app! another thing is when switching to full screen mode on another applications, the monitor will 'flicker' to default brightness mode for 2 seconds before reverting to the saved brightness mode. any fix for that?

  • Guests
  • Last active:
  • Joined: --
is anyone here? the GUI is killing me too. as it creates a new icon on the taskbar, alt+tab always switches to this script first before going to any of my other programs. i really like the script, but the gui + icon is driving me nuts :(

  • Guests
  • Last active:
  • Joined: --
still waiting for an answer on removing the gui! please help! :(

techie108
  • Members
  • 250 posts
  • Last active: Jul 01 2017 06:17 AM
  • Joined: 05 Aug 2012
Hi,

how do i make the GUI show as just a tray icon (or better yet, not show anything) instead of it being persistently on my taskbar? The problem is when I use Alt+tab once, it always switches to the black overlay first, before going to the program i need on the second tab.