I created a script which consists of a Gui with a picture inside of it.
Additionally, there is also a fade-in and a fade-out effect which works perfectly.
I use this Gui in scripts which take some seconds until they have finished.
(Just to inform the user that a script is being run.)
By using the include function, I add my Gui script into any other script.
It looks like this:
Code: Select all
#SingleInstance force
;Info-Meldungen
global d = 5 ; Verzögerung in ms
global bild ; Entweder Start, Ende oder Abbruch (Bild wird in der Gui angezeigt)
Start()
{
bild = Start.png
Gui_mit_Effekt()
}
Ende()
{
bild = Ende.png
SoundPlay, %A_WinDir%\Media\tada.wav
Sleep, d
Gui_mit_Effekt()
}
Gui_mit_Effekt()
{
Gui +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop ; Durchklickbar, rahmenlos, zuletzt gefunden, kein Taskleistensymbol, immer im Vordergrund
Gui, Add, Picture, x0 y0 w500 h250, %A_ScriptDir%\pics\Info-Meldungen\%bild% ; Vorgang erfolgreich-Bild
Gui, Show, w500 h250 hide, Ende
fade := 1 ; Variable für Einblend bzw. Ausblend-Effekt
Loop 25
{
fade := fade + 9 ; Einblend-Effekt
WinSet, Transparent, %fade% ; Pinke Farbe komplett rausfiltern, den Rest einblenden 0xFC62FD
if fade = 10 ; Beim ersten Durchgang:
{
WinShow, Ende ; Gui anzeigen
}
Sleep, 10
}
Sleep, 800
Loop 25
{
fade := fade - 9 ; Ausblend-Effekt
WinSet, Transparent, %fade% ; Pinke Farbe komplett rausfiltern, den Rest einblenden 0xFC62FD
if fade = 217 ; Beim ersten Durchgang:
{
WinShow, Ende ; Gui anzeigen
}
Sleep, 10
}
}
Code: Select all
#SingleInstance force
;Info-Meldungen-Test
#include Info-Meldungen.ahk
global d = 5 ; Verzögerung in ms
F1::
Start()
return
F2::
Ende()
return
I would like that it stays until it gets the information/command to disappear.
I think I will need to include a variable which tells the Start() function when to fade out.
Something like this:
Code: Select all
#SingleInstance force
;Info-Meldungen
global d = 5 ; Verzögerung in ms
global bild ; Entweder Start, Ende oder Abbruch (Bild wird in der Gui angezeigt)
Start(mode)
{
bild = Start.png
Gui_mit_Effekt(mode)
}
Ende(mode)
{
bild = Ende.png
SoundPlay, %A_WinDir%\Media\tada.wav
Sleep, d
Gui_mit_Effekt(mode)
}
Gui_mit_Effekt(mode)
{
Gui +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop ; Durchklickbar, rahmenlos, zuletzt gefunden, kein Taskleistensymbol, immer im Vordergrund
Gui, Add, Picture, x0 y0 w500 h250, %A_ScriptDir%\pics\Info-Meldungen\%bild% ; Vorgang erfolgreich-Bild
Gui, Show, w500 h250 hide, Ende
fade := 1 ; Variable für Einblend bzw. Ausblend-Effekt
if mode = 1
{
Loop 25
{
fade := fade + 9 ; Einblend-Effekt
WinSet, Transparent, %fade% ; Pinke Farbe komplett rausfiltern, den Rest einblenden 0xFC62FD
if fade = 10 ; Beim ersten Durchgang:
{
WinShow, Ende ; Gui anzeigen
}
Sleep, 10
}
}
if mode = 0
{
fade := 226
Sleep, 800
Loop 25
{
fade := fade - 9 ; Ausblend-Effekt
WinSet, Transparent, %fade% ; Pinke Farbe komplett rausfiltern, den Rest einblenden 0xFC62FD
if fade = 217 ; Beim ersten Durchgang:
{
WinShow, Ende ; Gui anzeigen
}
Sleep, 10
}
}
}
Code: Select all
#SingleInstance force
;Info-Meldungen-Test
#include Info-Meldungen.ahk
global d = 5 ; Verzögerung in ms
F1::
Start(1)
return
F2::
Start(0)
return
As soon as it gets called with a 0, it starts disappearing, but it looks weird.
- it disappears immediately without any effect
- then it appears again without any effect
- after this is starts disappearing, but it doesn't look as smooth as the first code.
Maybe it's just a small issue.
I realized that the fade value has to be set to 226 in the 2nd code, otherwise the script "forgets" it.
This is how it looks like:
Regards