Newsletter
Liste des sujets

Clavier disco ligth démarrage windows possible? (Script)

[Hieros]
[Hieros]
Niveau 32
31 janvier 2016 à 16:13:59

Bonjour, j'ai trouvé un super script qui fonctionne très bien pour que les lumières de mon clavier
fassent un cycle de couleur en appuyant sur deux touches de celui-ci (R-Shift + M1)

Je voudrais que cette effet s'active automatiquement au démarrage de windows,
est-ce que c'est possible? si oui est ce que quelqu'un pourrais me modifier ce
code?

Merci pour votre aide ça serais génial ! [[sticker:p/1kkh]]

TUTORIAL : Logitech Keyboards G510/G19 Disco Light Script [English]
https://www.youtube.com/watch?v=xnwLYsd3uUA

--  G19 Backlight Colour-Cycling Script
--  ------------------------------------------
--  Cobbled together and imaginatively titled by
--  White--Hawk (GH) - Edited in german by Jackjan

--  Thanks to everyone.


               ---------------
    ----------||  CONTROLS:  ||--------------
    --         ---------------             --
    --                                     --
    --                                     --
    --  R-Ctrl +                           --
    --      M1      -   Cycle R<>G         --
    --      M2      -   Cycle G<>B         --
    --      M3      -   Cycle B<>R         --
    --                                     --
    --  R-Shift +                          --
    --      M1      -   Cycle RGB          --
    --      M2      -   Cycle RBG          --
    --      M3      -   Colour Picker      --
    --                                     --
    --  While Cycling:                     --
    --  R-Shift +                          --
    --      L-Shift -   Faster             --
    --      L-Ctrl  -   Slower             --
    --                                     --
    --  L-Shift +                          --
    --      R-Ctrl  -   Toggle LHC mode    --
    --                  (G19/G13 sync)     --
    --                                     --
    --  While Picking:                     --
    --  R-Shift/R-Ctrl (brighter/darker) + --
    --      L-Shift -   Red                --
    --      L-Ctrl  -   Green              --
    --      L-Alt   -   Blue               --
    --                                     --
    --  Press any other MKey to stop       --
    --  cycling or picking, and keep       --
    --  selected colour.                   --
    --                                     --
    --                                     --
    -----------------------------------------

--  **Cycle rate:
--  **(default = 150; red-to-red in ~23secs)
--  **(always set lower than mrate)
rate = 150

--  **Minimum delay:
--  **(default = 600; red-to-red in ~1.5mins)
--  **(higher is slower)
mrate = 600

--  **Static (RGB) Colour:
--  **(default = 140, 255, 150; white on my G19)
R, G, B = 140, 255, 150

function OnEvent(event,arg)

--    Cycle or set custom colour:
    if (event=="M_PRESSED") and IsModifierPressed("rshift") then

--        Cycle RGB:
        if arg==1 then Cycle(0, 5, 0, 1, arg)

--        Cycle RBG:
        elseif arg==2 then Cycle(255, -5, 2, -1, arg)

        else

--            Set custom static colour.  Right Shift/Ctrl(+/-) plus Left-Shift/Ctrl/Alt(R/G/B).
            run=1
            while run~=null do
                if IsModifierPressed("rshift") then
                    if IsModifierPressed("lshift") then R=R+.1
                        if R>255 then R=255; end
                    end
                    if IsModifierPressed("lctrl") then G=G+.1 
                        if G>255 then G=255; end
                    end
                    if IsModifierPressed("lalt") then B=B+.1
                        if B>255 then B=255; end
                    end
                elseif IsModifierPressed("rctrl") then
                    if IsModifierPressed("lshift") then R=R-.1
                        if R<0 then R=0; end
                    end
                    if IsModifierPressed("lctrl") then G=G-.1
                        if G<0 then G=0; end
                    end
                    if IsModifierPressed("lalt") then B=B-.1
                        if B<0 then B=0; end
                    end
                end
                SetBacklightColor(math.floor(R),math.floor(G),math.floor(B))
                if (IsModifierPressed("lalt") and IsModifierPressed("ralt")) or GetMKeyState()~=3 then run=null; break; end
            end

--            All done?  Re-set new static colour after profiler applies default one.
            Sleep(350)
            SetBacklightColor(math.floor(R),math.floor(G),math.floor(B))
        end

    end

--    Reciprocating fade; Red <> Green or Green <> Blue or Blue <> Red:
    if (event=="M_PRESSED") and IsModifierPressed("rctrl") then Fade(arg); end

end

function Fade(ks)
    fs=0; fj=5; fd=0; run=1
    while run~=null do

--        Ramp colour value 0-255 (and back), or full-off to full-on.
        for col = fs, 255-fs, fj do

--            Call for delay before next colour change.
            Dlay(ks)

            if ks==1 then SetBacklightColor(255-col,col,0,"kb"); if lmode~="1" then SetBacklightColor(255-col,col,0,"lhc") else SetBacklightColor(col,255-col,0,"lhc") end
            elseif ks==2 then SetBacklightColor(0,255-col,col,"kb"); if lmode~="1" then SetBacklightColor(0,255-col,col,"lhc") else SetBacklightColor(0,col,255-col,"lhc") end
            elseif ks==3 then SetBacklightColor(col,0,255-col,"kb"); if lmode~="1" then SetBacklightColor(col,0,255-col,"lhc") else SetBacklightColor(255-col,0,col,"lhc") end
            end

--            Skip out of ramps...
            if run==null then break; end

        end

--        Change direction...
        if fd==0 then fd=1; fs=255; fj=-5
        else fd=0; fs=0; fj=5

--        Skip out of reciprocating fade...
        if run==null then break; end
        end
    end
end

function Cycle(cs, cj, rs, rj, ks)
    run=1
    while run~=null do

--        Loop through each of R, G, and B.
        for rgb = rs, 2-rs, rj do

--            Ramp colour value 0-255, or full-off to full-on.
            for col = cs, 255-cs, cj do

--                Call for delay before next colour change.
                Dlay(ks)

                if rgb==0 then SetBacklightColor(255-col,col,0,"kb"); if lmode~="1" then SetBacklightColor(255-col,col,0,"lhc") else SetBacklightColor(col,0,255-col,"lhc") end
                elseif rgb==1 then SetBacklightColor(0,255-col,col,"kb"); if lmode~="1" then SetBacklightColor(0,255-col,col,"lhc") else SetBacklightColor(255-col,col,0,"lhc") end
                elseif rgb==2 then SetBacklightColor(col,0,255-col,"kb"); if lmode~="1" then SetBacklightColor(col,0,255-col,"lhc") else SetBacklightColor(0,255-col,col,"lhc") end
                end

                if run==null then break; end
            end

--            Skip out of RGB loops...
            if run==null then break; end
        end

    end
end

function Dlay(ks)
--    Throttle controls during sleep.
    for z = 1, rate, 1 do

--        Faster...
        if IsModifierPressed("lshift") and IsModifierPressed("rshift") then rate=(rate-(mrate/6000))
            if rate<2 then rate=2
                if limit~=0 then limit=0; OutputLCDMessage("\n"..(string.rep(" ",37)).."Maximum", 3000); end
            end
--            Increments for display...
            dup=math.floor((60/mrate)*rate)
            if nup~=dup then Disp(); end

--        Slower...
        elseif IsModifierPressed("lctrl") and IsModifierPressed("rshift") then rate=(rate+(mrate/6000))
            if rate>mrate then rate=mrate; end
--            Increments for display...
            dup=math.floor((60/mrate)*rate)
            if nup~=dup or limit~=1 then Disp(); limit=1; end
        end

--        ~333ms control delay...
        if tt==null then tt=0 elseif tt<334 then tt=tt+1 end
        if tt>333 and IsModifierPressed("rctrl") and IsModifierPressed("lshift") then tt=0
            if lmode~="1" then lmode="1" else lmode="0" end
        end

--        Don't wait for delay if another M-key is pressed.
        if GetMKeyState()~=ks or (IsModifierPressed("lalt") and IsModifierPressed("ralt")) then run=null; break; end
        Sleep(1)

    end
end

function Disp()
--    Draw an incremental slider to G19 LCD output.  It grabs/drops focus rapidly.  :S
    text="\n\n\n\n\n\n        <["..(string.rep("||",60-dup)).."|||"..(string.rep("-",dup)).."]>"
    ClearLCD(); OutputLCDMessage(text, 2000)
    nup=dup
end
Message édité le 31 janvier 2016 à 16:14:45 par [Hieros]
[Hieros]
[Hieros]
Niveau 32
31 janvier 2016 à 22:21:35

J'ai trouvé merci :ok:

function OnEvent(event, arg)
for x = 0, 250, 5 do
Sleep(100)
SetBacklightColor(x,0,0,"kb")
end
while true do
for x = 0, 250, 5 do
Sleep(100)
SetBacklightColor(250,x,0,"kb")
end
for x = 250, 5, -5 do
Sleep(100)
SetBacklightColor(x,250,0,"kb")
end
for x = 0, 250, 5 do
Sleep(100)
SetBacklightColor(0,250,x,"kb")
end
for x = 250, 5, -5 do
Sleep(100)
SetBacklightColor(0,x,250,"kb")
end
for x = 0, 250, 5 do
Sleep(100)
SetBacklightColor(x,0,250,"kb")
end
for x = 250, 5, -5 do
Sleep(100)
SetBacklightColor(250,0,x,"kb")
end
end
end
Sous forums
  • Aide à l'achat Mac
  • Création de Jeux
  • Linux
  • Création de sites web
  • Programmation
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment