Jump to content

festive lighting


Gianni
 Share

Recommended Posts

Very cool, thanks for sharing.

Wish I'd remembered how to close it ... memory like a sieve.

Spoiler

Luckily I remembered about ALT-TAB to get back here .... ha ha ha ha :muttley:

I've now adjusted my copy of your script, to allow access to the Taskbar ... means I can also leave it running while doing some types of work. :)

Global $hGui2 = GUICreate("", 17, $iY - 17 - 47 , 0, 17, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; left bar
Global $idListview2 = GUICtrlCreateListView("", 0, 0, 17, $iY - 17 - 47)

Global $hGui3 = GUICreate("", $iX, 17, 0, $iY - 47, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; bottom bar

Global $hGui4 = GUICreate("", 17, $iY -17 -47, $iX - 17 , 17, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; right bar
Global $idListview4 = GUICtrlCreateListView("", 0, 0,17, $iY -17 -47)

Alternatively, I also made the bottom GUI not on top ... that also worked. :)

WinSetOnTop($hGui3, '', 0)

 

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

.. thanks all for the likes :)

12 hours ago, TheSaint said:

I've now adjusted my copy of your script, to allow access to the Taskbar...

Hi @TheSaint, you can also get the same result in one shot, just change from $iY = @DesktopHeight to $iY = @DesktopHeight - 47
or (just for fun) use the below variant of the script, that moves the panels while mouse get close... :)
however in this way you cannot put the focus on the lights by clicking to be able to turn them off with "ESC". Anyhow, you can still set focus on one of the light panels using ALT-TAB and then press ESC to turn lights off

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global $aColors = StringSplit("0x000000,0x0000AA,0x00AA00,0x00AAAA,0xAA0000,0xAA00AA,0xAAAA00,0xAAAAAA,0x555555,0x0000FF,0x00FF00,0x00FFFF,0xFF0000,0xFF00FF,0xFFFF00,0xFFFFFF", ',', 2)
Global $iColors = UBound($aColors) - 1
Global $iX = @DesktopWidth, $iY = @DesktopHeight
Global $iNrX = Int($iX / 17), $iNrY = Int($iY / 17) - 2
Global $hGui1 = GUICreate("", $iX, 17, 0, 0, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; top bar
Global $idListview1 = GUICtrlCreateListView("", 0, 0, $iX, 17)
GUICtrlSetStyle($idListview1, BitOR($LVS_ICON, $LVS_NOSCROLL))
GUISetState()
Global $hGui2 = GUICreate("", 17, $iY - 17 - 17, 0, 17, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; left bar
Global $idListview2 = GUICtrlCreateListView("", 0, 0, 17, $iY - 17 - 17)
GUICtrlSetStyle($idListview2, BitOR($LVS_ICON, $LVS_NOSCROLL))
GUISetState()
Global $hGui3 = GUICreate("", $iX, 17, 0, $iY - 17, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; bottom bar
Global $idListview3 = GUICtrlCreateListView("", 0, 0, $iX, 17)
GUICtrlSetStyle($idListview3, BitOR($LVS_ICON, $LVS_NOSCROLL))
GUISetState()
Global $hGui4 = GUICreate("", 17, $iY - 17 - 17, $iX - 17, 17, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ; right bar
Global $idListview4 = GUICtrlCreateListView("", 0, 0, 17, $iY - 17 - 17)
GUICtrlSetStyle($idListview4, BitOR($LVS_ICON, $LVS_NOSCROLL))
GUISetState()

Global $hImage = _GUIImageList_Create()
For $i = 0 To $iColors
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview1, $aColors[$i], 16, 16))
Next
_GUICtrlListView_SetImageList($idListview1, $hImage)
_GUICtrlListView_SetImageList($idListview2, $hImage)
_GUICtrlListView_SetImageList($idListview3, $hImage)
_GUICtrlListView_SetImageList($idListview4, $hImage)
For $x = 1 To $iNrX
    _GUICtrlListView_AddItem($idListview1, '', Random(0, $iColors, 1))
    _GUICtrlListView_AddItem($idListview3, '', Random(0, $iColors, 1))
Next
For $y = 1 To $iNrY
    _GUICtrlListView_AddItem($idListview2, '', Random(0, $iColors, 1))
    _GUICtrlListView_AddItem($idListview4, '', Random(0, $iColors, 1))
Next
_GUICtrlListView_SetIconSpacing($idListview1, 16 + 1, 16 + 1)
_GUICtrlListView_Arrange($idListview1)
_GUICtrlListView_SetIconSpacing($idListview2, 16 + 1, 16 + 1)
_GUICtrlListView_Arrange($idListview2)
_GUICtrlListView_SetIconSpacing($idListview3, 16 + 1, 16 + 1)
_GUICtrlListView_Arrange($idListview3)
_GUICtrlListView_SetIconSpacing($idListview4, 16 + 1, 16 + 1)
_GUICtrlListView_Arrange($idListview4)
_GUICtrlListView_EndUpdate($idListview1)
Do
    _GUICtrlListView_SetItem($idListview1, '', Random(0, $iNrX, 1), 0, Random(0, $iColors, 1))
    _GUICtrlListView_SetItem($idListview3, '', Random(0, $iNrX, 1), 0, Random(0, $iColors, 1))
    _GUICtrlListView_SetItem($idListview2, '', Random(0, $iNrY, 1), 0, Random(0, $iColors, 1))
    _GUICtrlListView_SetItem($idListview4, '', Random(0, $iNrY, 1), 0, Random(0, $iColors, 1))

    WinSetOnTop($hGui1, '', 1)
    WinSetOnTop($hGui2, '', 1)
    WinSetOnTop($hGui3, '', 1)
    WinSetOnTop($hGui4, '', 1)

    _MoveLights() ; check if it is necessary to move the lights
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _MoveLights()
    Local Static $y1 = 1, $x1 = 1, $y2 = -1, $x2 = -1, $iOffset = 34
    ; ---------------------------------------------
    ; https://www.autoitscript.com/forum/topic/95410-get-window-title-below-mouse-cursor/?do=findComment&comment=685922
    Local $pos = _WinAPI_GetMousePos()
    Local $hwnd = _WinAPI_WindowFromPoint($pos)
    While _WinAPI_GetParent($hwnd) <> 0
        $hwnd = _WinAPI_GetParent($hwnd)
    WEnd
    ; ---------------------------------------------
    If $hwnd = $hGui1 Then
        WinMove($hGui1, '', Default, WinGetPos($hGui1)[1] + $iOffset * $y1)
        $y1 *= -1
    EndIf
    If $hwnd = $hGui2 Then
        WinMove($hGui2, '', WinGetPos($hGui2)[0] + $iOffset * $x1, Default)
        $x1 *= -1
    EndIf
    If $hwnd = $hGui3 Then
        WinMove($hGui3, '', Default, WinGetPos($hGui3)[1] + $iOffset * $y2)
        $y2 *= -1
    EndIf
    If $hwnd = $hGui4 Then
        WinMove($hGui4, '', WinGetPos($hGui4)[0] + $iOffset * $x2, Default)
        $x2 *= -1
    EndIf
EndFunc   ;==>_MoveLights

 

Edited by Chimp
changed a 0 to a 1

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...