candyprogress - Fortschritt einmal anders...

Veröffentliche deine funktionierenden Skripte und Funktionen

Moderator: jNizM

User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

candyprogress - Fortschritt einmal anders...

Post by moefr01 » 10 Apr 2021, 08:28

Liebe AHK-Gemeinde,
um das pandemische Leben einmal etwas bunter zu machen, habe ich mich ein wenig mit dem progress-control beschäftigt und diese "aufgehübschte" Alternative gebastelt. Mein Interesse galt auch der Implementierung einer Icon-Bibliothek (cpIcons.icl) in Bezug auf das Picture-Control eines GUI. Überraschend was sich mit den "native codes" so alles umsetzen lässt ;) .

Funktionsweise: Darstellung eines progress-controls mit "überlagernden" pics links und rechts über dem Standard-progress-control und einem halbtransparenten pic in der Mitte, welches nur in der Länge angepasst werden kann. Anstelle dieser Icons (cpL, cpM, cpR) innerhalb der Bibliothek cpIcons.icl kann man auch eigene png-Dateien verwenden und somit eigene Dimensionen gestalten. Mit dem GuiControl-Befehl lassen sich die Farben einfach ändern. Wichtig ist auch die "doublebufferd GUI" mit +E0x02080000, sie ermöglicht erst das Ganze ruckelfrei und "overlayed"... beachtet bitte die umgekehrte Reihenfolge der hinzugefügten controls!

candyprogress.gif
Vorschau
candyprogress.gif (110.36 KiB) Viewed 4984 times

Code: Select all

Gui, -DPIScale +E0x02080000						;doublebuffered GUI
Gui, Color, FFCC00								;GUI windowcolor (see edge of left & right part)
Gui, Add,   Text, x20  y24 w436 h20  vCandyText cFFFFFF BackgroundTrans Center
Gui, Add,   Pic,  x20  y20 w18  h36  BackgroundTrans Icon1, cpIcons.icl		;left part
Gui, Add,   Pic,  x+   y20 w400 h36  BackgroundTrans Icon2, cpIcons.icl		;middle part
Gui, Add,   Pic,  x+   y20 w18  h36  BackgroundTrans Icon3, cpIcons.icl		;right part
Gui, Add,   Progress,  x20 y20  w436 h36 vCandyProgress
Gui, Show,  x500 y500 w476 h76, CandyProgress

value = 0
Loop {
     if (value >= 33) and (value <= 66)
	    color = FF00FF		;purple
     else if value >= 66
	    color = 00A0FF		;aqua
     else
	    color = 000000		;black
	 GuiControl, +c%color%, CandyProgress		;set progress color
     GuiControl, , CandyProgress, % value		;set progress value
	 GuiControl, , CandyText, % value "%"		;set progress text %
     value += 1
     if value > 100
	    {
		Sleep, 2000
        value = 0
	    }
     Sleep, 100
     }
Return

GuiEscape:
GuiClose:
ExitApp
Viel Spaß
moefr01 :wave:
Attachments
candyprogress.zip
beinhaltet: cpIcons.icl, candyprogress.ahk, candyprogress.gif
(70.4 KiB) Downloaded 132 times
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: candyprogress - Fortschritt einmal anders...

Post by BoBo » 10 Apr 2021, 11:51

Schaut mal richtig gut aus. R-E-S-P-E-K-T + vielen Dank fürs 'sharen' :thumbup:
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: candyprogress - Fortschritt einmal anders...

Post by Frosti » 11 Apr 2021, 02:47

Die Progressbars werden immer schöner. Ich kann mich kaum noch entscheiden!
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 03:57

Hallo liebe AHK-Coder,
anbei die erweiterte Version für vertikalen Fortschritt (positiv / negativ)... ;) .
Die cpIcons.icl habe ich um 3 Icons erweitert (pgT, pgV, pgT).
candyprogress.gif
Vorschau
candyprogress.gif (512.78 KiB) Viewed 4907 times

Code: Select all

Gui, -DPIScale +E0x02080000						;doublebuffered GUI
Gui, Color, FFCC00								;GUI windowcolor (see edge of left & right part)
Gui, Add,   Text, x20  y24 w436 h20  vCandyText  cFFFFFF BackgroundTrans Center
Gui, Add,   Text, x20  y170 w36 h48  vCandyTextV cFFFFFF BackgroundTrans Center
Gui, Add,   Pic,  x20  y20 w18  h36  BackgroundTrans Icon1, cpIcons.icl		;left part
Gui, Add,   Pic,  x+   y20 w400 h36  BackgroundTrans Icon2, cpIcons.icl		;middle part
Gui, Add,   Pic,  x+   y20 w18  h36  BackgroundTrans Icon3, cpIcons.icl		;right part
Gui, Add,   Progress,  x20 y20  w436 h36 vCandyProgress 					;-Smooth = deactivates colorizing!
Gui, Add,   Pic,  x20  y70 w36  h18  BackgroundTrans Icon4, cpIcons.icl		;top part
Gui, Add,   Pic,  x20  y+  w36  h200 BackgroundTrans Icon5, cpIcons.icl		;vertical middle part
Gui, Add,   Pic,  x20  y+  w36  h18  BackgroundTrans Icon6, cpIcons.icl		;bottom part
Gui, Add,   Progress,  x20 y70  w36  h236 vCandyProgressV vertical			;-Smooth = deactivates colorizing!
Gui, Show,  x500 y500 w476 h320, CandyProgress

value = 0
Loop {
     if (value >= 33) and (value <= 66)
	    color = FF00FF		;purple
     else if value >= 66
	    color = 00A0FF		;aqua
     else
	    color = 000000		;black
	 GuiControl, +c%color%, CandyProgress			;set progress color
     GuiControl, , CandyProgress, % abs(value)		;set progress value
	 GuiControl, , CandyText, % abs(value) "%"		;set progress text %
	 GuiControl, +c%color%, CandyProgressV			;set vertical progress color
     GuiControl, , CandyProgressV, % abs(value)		;set vertical progress value
	 GuiControl, , CandyTextV, % abs(value) "`n%"	;set vertical progress text %
     value += 1
     if value > 100
	    {
		Sleep, 2000
        value = -100-value
	    }
     Sleep, 50
     }
Return

GuiEscape:
GuiClose:
ExitApp
cheers... moefr01 :wave:
Attachments
CandyProgress.zip
beinhaltet: cpIcons.icl, candyprogress.ahk, candyprogress.gif
(363.14 KiB) Downloaded 124 times
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by just me » 11 Apr 2021, 04:35

Moin,

ein interessantes Konzept mit sehr gelungenem Ergebnis.

Danke!
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: candyprogress - Fortschritt einmal anders...

Post by Frosti » 11 Apr 2021, 05:21

Kannst Du das auch in Form einer sich füllenden Bierflasche darstellen?
Johnny R
Posts: 348
Joined: 03 Oct 2013, 02:07

Re: candyprogress - Fortschritt einmal anders...

Post by Johnny R » 11 Apr 2021, 06:40

Hübsches Ding. Aber wie steuert man das Teil?
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 11:19

Frosti wrote:
11 Apr 2021, 05:21
Kannst Du das auch in Form einer sich füllenden Bierflasche darstellen?
Geht auch 'ne Flasche Himbeersaft? :lol:
bottleprogress.gif
bottleprogress.gif (110.29 KiB) Viewed 4842 times
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 11:43

Johnny R wrote:
11 Apr 2021, 06:40
Hübsches Ding. Aber wie steuert man das Teil?
Eigentlich wie das Standard-Progress-Control mit seinen x y w h vertical - Parametern. Zu beachten ist lediglich die zusätzliche Angabe der Picture-Controls im Randbereich des Fortschrittbalkens: beim horizontalem Forschritt beginnt man das linke picture an der x-Anfangsposition, dann das mittlere und schließlich das rechte zu setzen. Quasi überdecken diese 3 pictures dann das eigentliche Standard-Progress-Control. Beim vertikalem Fortschritt beginnt man oben mit dem Top-picture an der y-Anfangsposition, dann das mittlere und schließlich das untere Bottom-picture zu setzen. Deine Anpassungen bzgl. der Fortschrittbalkenlänge legst Du mit den Parametern w (horizontal) oder h (vertikal) fest (siehe progress control GUI). Die von mir erstellten pictures sind zT. halbtransparent und wie bereits erwähnt in der cpIcons.icl (Iconbibliothek) in der Reihenfolge Links-Mitte-Rechts bzw. Top-Vertical-Bottom abgelegt. Du kannst aber auch ersatzweiße eigene pictures als png-Dateien erstellen und diese nach diesem Schema positionieren (siehe weiteres Beispiel: bottleProgress.ahk).
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 11:50

hier die Anhänge: bottleprogress.ahk, bottle64x248.png, bottleprogress.gif in der bottleprogress.zip
bottleprogress.gif
Himbeersaft!
bottleprogress.gif (110.29 KiB) Viewed 4830 times

Code: Select all

Gui, -DPIScale +E0x02080000						;doublebuffered GUI
Gui, Color, FFCC00								;GUI windowcolor (see edge of left & right part)
Gui, Add,   Text, x34  y130 w36 h48  vCandyTextV cFFFFFF BackgroundTrans Center
Gui, Add,   Pic,  x20  y20 w64  h248 BackgroundTrans, bottle64x248.png
Gui, Add,   Progress,  x22 y84  w60  h184 vCandyProgressV vertical 			;-Smooth = deactivates colorizing!
Gui, Show,  x500 y500 w104 h288, CandyProgress

value = 0
Loop {
	 color = FF0070									;raspberry
	 GuiControl, +c%color%, CandyProgressV			;set vertical progress color
     GuiControl, , CandyProgressV, % abs(value)		;set vertical progress value
	 GuiControl, , CandyTextV, % abs(value) "`n%"	;set vertical progress text %
     value += 1
     if value > 100
	    {
		Sleep, 2000
        value = -100-value
	    }
     Sleep, 10
     }
Return

GuiEscape:
GuiClose:
ExitApp
Have fun! ... moefr01 :wave:
Attachments
bottleprogress.zip
(109.3 KiB) Downloaded 122 times
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: candyprogress - Fortschritt einmal anders...

Post by BoBo » 11 Apr 2021, 11:51

[beancount]Die Flasche unten gerade machen (wie den Ausguss oben) sonst stimmt auf die(se kurze) Länge die Perspektive des Flüssigkeitstandes nicht mehr.[/beancount] :shh:
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 12:03

bottle64x248.png
perspektivische Geraderückung der Flasche:-)
bottle64x248.png (27.49 KiB) Viewed 4820 times
Du hast ja so Recht ... BoBo ... Danke für den Ratschlag :crazy:
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 11 Apr 2021, 12:30

kleine Syntax-Korrektur in Zeile 18:

Code: Select all

...
value := -value     ;vorher falsch: value = -100-value
...
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: candyprogress - Fortschritt einmal anders...

Post by Frosti » 11 Apr 2021, 13:33

Ja cool das sollte eigentlich nur ein Witz sein! Die Weinflasche ist aber besser als eine Bierflasche.
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 12 Apr 2021, 07:19

Hallo liebe AHK-Coder,

ich habe heute den code optimiert und die grafischen Fehler in den Icons entfernt.
candyprogress.gif
Vorschau
candyprogress.gif (430.45 KiB) Viewed 4730 times

Code: Select all

;CandyProgress... candy-like progressbar with rounded edges and semitransparent overlay-graphics,
;                 length-setting possible, use own transparent png-graphics optionally as edge-icons
;coded 2021 by moefr01
;https://www.autohotkey.com/boards/viewtopic.php?f=10&t=89198
;========================================================================================================================
#NoEnv
#Persistent
#NoTrayIcon
#SingleInstance Force
SetBatchLines -1
SetWinDelay -1
SendMode Input
SetWorkingDir %A_ScriptDir%
;========================================================================================================================
Gui, -DPIScale +E0x02080000				;doublebuffered GUI ...for smoothiness and no flicker! ;-)
Gui, Color, 00B2FF						;GUI windowcolor (see edge of left, middle & right progress-iconparts)
Gui, Font, s8 cFFFFFF, Segoe UI			;font, size & color
Gui, Margin, 20, 20						;margin of controls
;========================================================================================================================
Gui, Add,  Text,     xm  ym   w436 h38  vCandyText  BackgroundTrans Center			;text overlay = topmost
Gui, Add,  Pic,      xm  ym   w18  h38  BackgroundTrans Icon1, cpIconsBlau.icl		;left progresspart w18h38
Gui, Add,  Pic,      x+       w400 h38  BackgroundTrans Icon2, cpIconsBlau.icl		;middle progresspart w400h38
Gui, Add,  Pic,      x+       w18  h38  BackgroundTrans Icon3, cpIconsBlau.icl		;right progresspart w18h38
Gui, Add,  Progress, xm  ym   w436 h38  vCandyProgress ;-Smooth                     ;<= deactivates colorizing
;========================================================================================================================
Gui, Add,  Text,     xm  y120 w38  h76  vCandyTextV BackgroundTrans Center			;text overlay = topmost
Gui, Add,  Pic,      xm  y70  w38  h18  BackgroundTrans Icon4, cpIconsBlau.icl		;top progresspart w38h18
Gui, Add,  Pic,           y+  w38  h100 BackgroundTrans Icon5, cpIconsBlau.icl		;vertical middle progresspart w38h100
Gui, Add,  Pic,           y+  w38  h18  BackgroundTrans Icon6, cpIconsBlau.icl		;bottom progresspart w38h18
Gui, Add,  Progress, xm  y70  w38  h136 vCandyProgressV vertical ;-Smooth           ;<= deactivates colorizing
;========================================================================================================================
Gui, Show, , CandyProgress															;show GUI
;========================================================================================================================
value = 0
Loop {
     if (value >= 33) and (value <= 66)
	    color = FF00FF		;purple
     else if value >= 66
	    color = 0000FF		;blue
     else
	    color = 000000		;black
	 GuiControl, +c%color%, CandyProgress			;set progress color or commentize for -Smooth effect
     GuiControl, , CandyProgress, % abs(value)		;set progress value
	 GuiControl, , CandyText, % abs(value) " %"		;set progress text with % symbol
	 GuiControl, +c%color%, CandyProgressV			;set vertical progress color or commentize for -Smooth effect
     GuiControl, , CandyProgressV, % abs(value)		;set vertical progress value
	 GuiControl, , CandyTextV, % abs(value) "`n%"	;set vertical progress text with % symbol
     value += 1
     if value > 100
	    {
		Sleep, 2000
        value := -value
	    }
     Sleep, 50
     }
Return
;========================================================================================================================
GuiEscape:
GuiClose:
ExitApp
Viele Grüße...moefr01 :wave:
Attachments
candyprogress.zip
(300.51 KiB) Downloaded 125 times
User avatar
moefr01
Posts: 115
Joined: 25 Nov 2015, 09:01
Location: Germany

Re: candyprogress - Fortschritt einmal anders...

Post by moefr01 » 13 Apr 2021, 12:35

Ich habe heute die candyprogress-Versionen um eine Variante erweitert... diesmal ohne Hintergrundcolorierung aber mit animierter Form.
Funktionsweise: 3 Icons (32x64px) in einer icl-Bibliothek erstellt, linkes Icon ist statisch, das mittlere wird in der Breite gestreckt, rechtes Icon wird mit zunehmender Breite verschoben (umgesetzt mit GUI, Move ...)
candyprogress2.gif
Version 2
candyprogress2.gif (549.33 KiB) Viewed 4680 times
Code stelle ich demnächst ein. :P
moefr01 :wave:
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: candyprogress - Fortschritt einmal anders...

Post by Frosti » 14 Apr 2021, 00:09

Wird ja immer besser.
Könntest Du auch ein Spritze animieren?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: candyprogress - Fortschritt einmal anders...

Post by BoBo » 14 Apr 2021, 01:40

@moefr01 - :thumbup: Anm. Wenn die Ausgangslage eine Kugel darstellen soll, wäre dann die Lichtreflektion (bzw. dessen gerade Linien) auf deren Oberfläche nicht kugeliger/kreisförmiger/gewölbter auszuformen? Da das sicherlich zu aufwändig wäre dürfte die Reflektion in Position '0' als Kreis anzulegen die einfachste Lösung sein ... :think:
garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

Re: candyprogress - Fortschritt einmal anders...

Post by garry » 14 Apr 2021, 05:08

danke , sehr schöne Beispiele , hier noch ein Progress-Bar ... :)
Image
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: candyprogress - Fortschritt einmal anders...

Post by BoBo » 14 Apr 2021, 06:51

Dasama der Killer :lol: :thumbup: :mrgreen: Nun, nach Brexit mit C19 Zuschlag scheints im "United" Kingdom ebbes mau mit progress, bar aller Versprechungen durch it's blonde hairiness BoJo(hnson) :think:
Post Reply

Return to “Skripte und Funktionen”