Sign in to follow this  
Followers 0
jlorenz1

changing fontsize of a label let flickering the screen

4 posts in this topic

Hi, my problem with other I've scripted a screensaver in autoit. It works, but it's flickering like the decribtion in the helpfile "SplashTextOn ", when the fontsize of the label $Bez will be changed. Try it and see the result. How can I create a smooth version of this?? Thanx Johannes

#include <GUIConstants.au3>
#include <File.au3>

;first edition of an screen saver
$ininame='bschoner.ini'




$font=IniRead($ininame, 'Configuration', 'Schrift', 'Arial')
$textcolor=IniRead($ininame, 'Configuration', 'Textfarbe', 0xff0000)
$fontsize=IniRead($ininame, 'Configuration', 'Schriftgrösse', 24)
$txtdatei=IniRead($ininame, 'Configuration', 'Textdatei', 'bschoner.txt')
$nachKTag=IniRead($ininame, 'Configuration', 'NachKalenderTag', 'no')
$letzteBildnr=IniRead($ininame, 'Configuration', 'letzteBildnr', 1)
$LastCall=IniRead($ininame, 'Configuration', 'letzterAufruf', 1)

$fontsizeNow = $fontsize
If FileExists($txtdatei) then 
    $ZeilenAnzahl=_FileCountLines ( $txtdatei)
    $h=FileOpen($txtdatei,0)
    MsgBox(4096,'','SELECT',1)
    Select
        Case $nachKTag='ja' and $ZeilenAnzahl >= 365
            $txt=FileReadLine($h, @YDAY)    
        Case $nachKTag='ja' and $ZeilenAnzahl < 365    and @YDAY <= $ZeilenAnzahl
            If $LastCall = @YDAY Then
                $txt=FileReadLine($h, @YDAY)                
            Else
                $txt=FileReadLine($h, @YDAY)
                IniWrite($ininame, 'Configuration', 'letzterAufruf', @YDAY)
            EndIf
        Case Else
            $i=@YDAY
            Do
                $i=$i-$ZeilenAnzahl
            Until $i <= $Zeilenanzahl
            $txt=FileReadLine($h, $i)
    EndSelect
    FileClose ($h)
Else
    $txt='Dies ist nur ein Beispieltext für den Bildschirmschoner'
EndIf

GUICreate('', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE))
; paradies.jpg exists under W2K, XP has other filenames, the directory is the same 
$Bild1 = GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\turquoise.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1,$GUI_DISABLE)
$Bez=GUICtrlCreateLabel ($txt, 30, 80, @DesktopWidth -60, @DesktopHeight-180, BitOr($SS_CENTERIMAGE, $SS_CENTER) )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor ( -1, $textcolor)     

$grosklein = 1
GUICtrlSetFont (-1, $fontsize, 400, 1, $font)
GUISetState (@SW_SHOW)     
$fontsizeMax = $fontsize +100
AdlibEnable("_fontsize",500)
While 1
    $msg = GUIGetMsg()
    


            
;~         EndIf
;~         Sleep (1000)
    ;$a=MsgBox(4096,'','Jetzt sollte sich am Textformat etwas ändern. Beenden mit OK',2)
    ;If $a=1 then Exit
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func _fontsize()
        If $fontsizeNow > $fontsizeMax then $grosklein = -1
        If $fontsizeNow < $fontsize then $grosklein = 1

$fontsizeNow += 10*$grosklein
            GUICtrlSetFont ($Bez, $fontsizeNow, 400, 1, $font)    
EndFunc


$font=IniRead($ininame, 'Configuration', 'Schrift', 'Arial')
$textcolor=IniRead($ininame, 'Configuration', 'Textfarbe', 0xff0000)
$fontsize=IniRead($ininame, 'Configuration', 'Schriftgrösse', 24)
$txtdatei=IniRead($ininame, 'Configuration', 'Textdatei', 'bschoner.txt')
$nachKTag=IniRead($ininame, 'Configuration', 'NachKalenderTag', 'nein')
$letzteBildnr=IniRead($ininame, 'Configuration', 'letzteBildnr', 1)
$LastCall=IniRead($ininame, 'Configuration', 'letzterAufruf', 1)

$fontsizeNow = $fontsize
If FileExists($txtdatei) then 
    $ZeilenAnzahl=_FileCountLines ( $txtdatei)
    $h=FileOpen($txtdatei,0)
    MsgBox(4096,'','SELECT',1)
    Select
        Case $nachKTag='ja' and $ZeilenAnzahl >= 365
            $txt=FileReadLine($h, @YDAY)    
        Case $nachKTag='ja' and $ZeilenAnzahl < 365    and @YDAY <= $ZeilenAnzahl
            If $LastCall = @YDAY Then
                $txt=FileReadLine($h, @YDAY)                
            Else
                $txt=FileReadLine($h, @YDAY)
                IniWrite($ininame, 'Configuration', 'letzterAufruf', @YDAY)
            EndIf
        Case Else
            $i=@YDAY
            Do
                $i=$i-$ZeilenAnzahl
            Until $i <= $Zeilenanzahl
            $txt=FileReadLine($h, $i)
    EndSelect
    FileClose ($h)
Else
    $txt='Dies ist nur ein Beispieltext für den Bildschirmschoner'
EndIf

GUICreate('', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE))
; paradies.jpg exists under W2K, XP has other filenames, the directory is the same 
$Bild1 = GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\turquoise.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1,$GUI_DISABLE)
$Bez=GUICtrlCreateLabel ($txt, 30, 80, @DesktopWidth -60, @DesktopHeight-180, BitOr($SS_CENTERIMAGE, $SS_CENTER) )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor ( -1, $textcolor)     

$grosklein = 1
GUICtrlSetFont (-1, $fontsize, 400, 1, $font)
GUISetState (@SW_SHOW)     
$fontsizeMax = $fontsize +100
AdlibEnable("_fontsize",500)
While 1
    $msg = GUIGetMsg()
    


            
;~         EndIf
;~         Sleep (1000)
    ;$a=MsgBox(4096,'','Jetzt sollte sich am Textformat etwas ändern. Beenden mit OK',2)
    ;If $a=1 then Exit
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func _fontsize()
        If $fontsizeNow > $fontsizeMax then $grosklein = -1
        If $fontsizeNow < $fontsize then $grosklein = 1

$fontsizeNow += 10*$grosklein
            GUICtrlSetFont ($Bez, $fontsizeNow, 400, 1, $font)    
EndFunc

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites



Hi, my problem with other I've scripted a screensaver in autoit. It works, but it's flickering like the decribtion in the helpfile "SplashTextOn ", when the fontsize of the label $Bez will be changed. Try it and see the result. How can I create a smooth version of this?? Thanx Johannes

The flickering might be less if you try this

Const $WS_EX_COMPOSITED = 0x2000000
GUICreate('', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE),$WS_EX_COMPOSITED)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Martin,

thanks for your help. I changed the two lines of the script, but it doesn't work.

AutoIt Wrapper only reports:

>"D:\Programme\Programmieren\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\bildschirmschoner1.au3" /autoit3dir "D:\Programme\Programmieren\AutoIt3" /UserParams  
+> Starting AutoIt3Wrapper v.1.7.5
>Running AU3Check (1.54.10.0)  params:  from:D:\Programme\Programmieren\AutoIt3
+>AU3Check ended.rc:0
>Running:(3.2.10.0):D:\Programme\Programmieren\AutoIt3\autoit3.exe "D:\bildschirmschoner1.au3"

But the screensaver won't be display. No error message.

I use the last stabile autoit version v3.2.10.0 and W2K as system.

Johannes

This is my last script

#include <GUIConstants.au3>
#include <File.au3>
Const $WS_EX_COMPOSITED = 0x2000000

;first edition of an screen saver
$ininame='bschoner.ini'
Global $Bez, $Bez1
$b=0


$font=IniRead($ininame, 'Configuration', 'Schrift', 'Arial')
$textcolor=IniRead($ininame, 'Configuration', 'Textfarbe', 0xff0000)
$fontsize=IniRead($ininame, 'Configuration', 'Schriftgrösse', 24)
$txtdatei=IniRead($ininame, 'Configuration', 'Textdatei', 'bschoner.txt')
$nachKTag=IniRead($ininame, 'Configuration', 'NachKalenderTag', 'nein')
$letzteBildnr=IniRead($ininame, 'Configuration', 'letzteBildnr', 1)
$LastCall=IniRead($ininame, 'Configuration', 'letzterAufruf', 1)

$fontsizeNow = $fontsize
If FileExists($txtdatei) then 
    $ZeilenAnzahl=_FileCountLines ( $txtdatei)
    $h=FileOpen($txtdatei,0)
    MsgBox(4096,'','SELECT',1)
    Select
        Case $nachKTag='ja' and $ZeilenAnzahl >= 365
            $txt=FileReadLine($h, @YDAY)    
        Case $nachKTag='ja' and $ZeilenAnzahl < 365    and @YDAY <= $ZeilenAnzahl
            If $LastCall = @YDAY Then
                $txt=FileReadLine($h, @YDAY)                
            Else
                $txt=FileReadLine($h, @YDAY)
                IniWrite($ininame, 'Configuration', 'letzterAufruf', @YDAY)
            EndIf
        Case Else
            $i=@YDAY
            Do
                $i=$i-$ZeilenAnzahl
            Until $i <= $Zeilenanzahl
            $txt=FileReadLine($h, $i)
    EndSelect
    FileClose ($h)
Else
    $txt='Dies ist nur ein Beispieltext für den Bildschirmschoner'
EndIf

;GUICreate('Screensaver', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE))
GUICreate('Screensaver', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE), $WS_EX_COMPOSITED)
; paradies.jpg exists under W2K, XP has other filenames, the directory is the same 
$Bild1 = GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\paradies.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1,$GUI_DISABLE)
$Bez=GUICtrlCreateLabel ($txt, 30, 80, @DesktopWidth -60, @DesktopHeight-180, BitOr($SS_CENTERIMAGE, $SS_CENTER) )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor ( -1, $textcolor)
$Bez1=GUICtrlCreateLabel ($txt, 30, 80, @DesktopWidth -60, @DesktopHeight-180, BitOr($SS_CENTERIMAGE, $SS_CENTER) )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor ( -1, 0x00ff00)
GUICtrlSetState($Bez1, $GUI_HIDE)

$grosklein = 1
GUICtrlSetFont (-1, $fontsize, 400, 1, $font)
GUISetState (@SW_SHOW)     
$fontsizeMax = $fontsize +100
AdlibEnable("_fontsize",2500)
While 1
    $msg = GUIGetMsg()
    


            
;~         EndIf
;~         Sleep (1000)
    ;$a=MsgBox(4096,'','Jetzt sollte sich am Textformat etwas ändern. Beenden mit OK',2)
    ;If $a=1 then Exit
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func _fontsize()
    #cs
    If $fontsizeNow > $fontsizeMax then $grosklein = -1
    If $fontsizeNow < $fontsize then $grosklein = 1

    $fontsizeNow += 10*$grosklein
    GUICtrlSetFont ($Bez, $fontsizeNow, 400, 1, $font)  

    If $textcolor=0xff0000 then $textcolor = 0xffffff 
    If $textcolor<>0xff0000  then $textcolor = 0xff0000 
    GUICtrlSetColor ($Bez, $textcolor)

        If $fontsizeNow > $fontsizeMax then $grosklein = -1
    If $fontsizeNow < $fontsize then $grosklein = 1

    $fontsizeNow += 10*$grosklein
    GUICtrlSetData ($Bez, '')
    GUICtrlSetFont ($Bez, $fontsizeNow, 400, 1, $font)
    GUICtrlSetData ($Bez, $txt)
    #ce 
    If $b=1 Then
        GUICTrlSetState($Bez, $GUI_HIDE)
        GUICTrlSetState($Bez1, $GUI_SHOW)       
        $b=0
    Else
        GUICTrlSetState($Bez1, $GUI_HIDE)
        GUICTrlSetState($Bez, $GUI_SHOW)        
        $b=1
    EndIf   
EndFunc
Edited by jlorenz1

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

Hi Martin,

thanks for your help. I changed the two lines of the script, but it doesn't work.

I didn't look at your latest code but I modified your first post and it seems to work for me.

#include <GUIConstants.au3>
#include <File.au3>

;first edition of an screen saver
$ininame='bschoner.ini'

Global $bgo = False


;$Main_GUI = GUICreate("Main",500,500,-1,-1, $WS_EX_TRANSPARENT,$WS_EX_COMPOSITED)


$font=IniRead($ininame, 'Configuration', 'Schrift', 'Arial')
$textcolor=IniRead($ininame, 'Configuration', 'Textfarbe', 0xff0000)
$fontsize=IniRead($ininame, 'Configuration', 'Schriftgrösse', 24)
$txtdatei=IniRead($ininame, 'Configuration', 'Textdatei', 'bschoner.txt')
$nachKTag=IniRead($ininame, 'Configuration', 'NachKalenderTag', 'no')
$letzteBildnr=IniRead($ininame, 'Configuration', 'letzteBildnr', 1)
$LastCall=IniRead($ininame, 'Configuration', 'letzterAufruf', 1)

$fontsizeNow = $fontsize
If FileExists($txtdatei) then
    $ZeilenAnzahl=_FileCountLines ( $txtdatei)
    $h=FileOpen($txtdatei,0)
    MsgBox(4096,'','SELECT',1)
    Select
        Case $nachKTag='ja' and $ZeilenAnzahl >= 365
            $txt=FileReadLine($h, @YDAY)   
        Case $nachKTag='ja' and $ZeilenAnzahl < 365 and @YDAY <= $ZeilenAnzahl
            If $LastCall = @YDAY Then
                $txt=FileReadLine($h, @YDAY)               
            Else
                $txt=FileReadLine($h, @YDAY)
                IniWrite($ininame, 'Configuration', 'letzterAufruf', @YDAY)
            EndIf
        Case Else
            $i=@YDAY
            Do
                $i=$i-$ZeilenAnzahl
            Until $i <= $Zeilenanzahl
            $txt=FileReadLine($h, $i)
    EndSelect
    FileClose ($h)
Else
    $txt='Dies ist nur ein Beispieltext für den Bildschirmschoner'
EndIf
Const $WS_EX_COMPOSITED = 0x2000000
GUICreate('', -1, -1, 0, 0, BitOr($WS_POPUP, $WS_MAXIMIZE),$WS_EX_COMPOSITED)
; paradies.jpg exists under W2K, XP has other filenames, the directory is the same
;$Bild1 = GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\purpleflower.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
;GUICtrlSetState(-1,$GUI_DISABLE)
$Bez=GUICtrlCreateLabel ($txt, 30, 80, @DesktopWidth -60, @DesktopHeight-180, BitOr($SS_CENTERIMAGE, $SS_CENTER) )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor ( -1, $textcolor) 
     

$grosklein = 1
GUICtrlSetFont (-1, $fontsize, 400, 1, $font)
GUISetState (@SW_SHOW)   
$fontsizeMax = $fontsize +100
AdlibEnable("_fontsize",150)
While 1
    $msg = GUIGetMsg()
   


           
;~       EndIf
;~       Sleep (1000)
   ;$a=MsgBox(4096,'','Jetzt sollte sich am Textformat etwas ändern. Beenden mit OK',2)
   ;If $a=1 then Exit
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend



Func _fontsize()
        If $fontsizeNow > $fontsizeMax then $grosklein = -1
        If $fontsizeNow < $fontsize then $grosklein = 1

$fontsizeNow += $grosklein*3

            GUICtrlSetFont ($Bez, $fontsizeNow, 400, 1, $font)   
        
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0