Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Best way to create an horizontal scrolling text ?

scroll

  • Please log in to reply
14 replies to this topic

#1 fgilain

fgilain

    Seeker

  • Active Members
  • 18 posts

Posted 05 February 2012 - 10:56 PM

Hi all,

I'd like to create a simple way to diffuse some text messages at the bottom of a screen from right to left on the entire width in continue.

Goal is to diffuse message to my company's people on a 16/9 TV in a continue way. Messages would be taken from text files created in a specified directory....

How could i do this with AutoIT ?

thanks a lot for your help.

Florent







#2 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,471 posts

Posted 06 February 2012 - 12:08 PM

fgilain,

Look at the Marquee UDF in my sig - should do what you want. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 UEZ

UEZ

    Never say never

  • MVPs
  • 4,889 posts

Posted 06 February 2012 - 01:02 PM

Here another example:

Simple Horizontal Label Scroller.au3 Attached File  Simple Horizontal Label Scroller.au3   1.3KB   199 downloads
AutoIt         
;coded by UEZ 2012 build 2012-03-09 #include <windowsconstants.au3> #include "Scroller.au3" $iW = 640 $iH = Int($iW * 9 / 16) $hGUI = GUICreate("Simple Horizontal Scroller", $iW, $iH, -1, -1, Default, $WS_EX_COMPOSITED) GUISetState() $sText = "This is a simple horizontal scroller made with AutoIt using a label! Using this technique is not the best way because label is flickering :-(" $aHScroller1= Scroller_Init($hGUI, 64, $sText, "Arial", 96, 0, 0x006000, False, False, 0xABCDEF) If @error Then Exit MsgBox(16, "ERROR", "Unable to initiate scroller", 10) $aHScroller2= Scroller_Init($hGUI, $iH - 64, $sText, "Comic Sans MS", 24, 0, 0, True, True) If @error Then Exit MsgBox(16, "ERROR", "Unable to initiate scroller", 10) HotKeySet("{F1}", "Init_Scroller_Off") HotKeySet("{F2}", "Init_Scroller_On") HotKeySet("{F3}", "Init_Scroller_Reset") AdlibRegister("Scroll_It", 30) Do Until GUIGetMsg() = -3 _Exit() Func Scroll_It()     Scroller_Move($aHScroller1, 1.25)     Scroller_Move($aHScroller2, 1) EndFunc Func Init_Scroller_Off()     Scroller_Off($aHScroller1[0]) EndFunc Func Init_Scroller_On()     Scroller_On($aHScroller1[0]) EndFunc Func Init_Scroller_Reset()     Scroller_Reset($aHScroller1) EndFunc Func _Exit()     AdlibUnRegister("Scroll_It")     GUIDelete($hGUI)     Exit EndFunc



Scroller.au3 Attached File  Scroller.au3   2.99KB   213 downloads
AutoIt         
;coded by UEZ 2012 build 2012-03-11 #include-once #include <guiconstantsex.au3> #include <staticconstants.au3> #include <gdiplus.au3> Func Scroller_Init($hGUI, $iY, $sText, $sFont = "Arial", $iFSize = 24, $iFStyle = 0, $iFColor = 0x000000, $hl = False, $bgc = False, $bgcolor = 0xFEDCBA)     If Not IsHWnd($hGUI) Then Return SetError(1, 0, 0)     If $sText = "" Then Return SetError(2, 0, 0)     Local $aSize = WinGetClientSize($hGUI)     Local $aStringSize =  GetStringSize($sText, $sFont, $iFSize, $iFStyle)     Local $idLabel_Scroller = GUICtrlCreateLabel($sText, $aSize[0], $iY, $aStringSize[0], $aStringSize[1])     Local $fWeight = 400     If BitAND($iFStyle, 1) Then $fWeight = 800     GUICtrlSetFont($idLabel_Scroller, $iFSize, $fWeight , BitXOR($iFStyle, 1), $sFont, 4)     GUICtrlSetColor($idLabel_Scroller, $iFColor)     If $bgc Then         Local $idLabel_BG = GUICtrlCreateLabel("", 0, $iY - 3, $aSize[0], $aStringSize[1] + 3)         GUICtrlSetBkColor($idLabel_BG, $bgcolor)         GUICtrlSetState($idLabel_BG, $GUI_DISABLE)         GUICtrlSetBkColor($idLabel_Scroller, $bgcolor)     EndIf     If $hl Then         Local $idLabel_HorizontalLine1 = GUICtrlCreateLabel("", 0, $iY - 4, $aSize[0] + 4, 2, $SS_ETCHEDHORZ)         Local $idLabel_HorizontalLine2 = GUICtrlCreateLabel("", 0, $iY + $aStringSize[1], $aSize[0] + 4, 2, $SS_ETCHEDHORZ)     EndIf     Local $aData[4] = [$idLabel_Scroller, $aStringSize[0], $aSize[0] + $iFSize, $aSize[0] + $iFSize] ;id label, string width, gui width, $iPos     Return $aData EndFunc Func Scroller_Off($idControl)     GUICtrlSetState($idControl, $GUI_HIDE) EndFunc Func Scroller_On($idControl)     GUICtrlSetState($idControl, $GUI_SHOW) EndFunc Func Scroller_Reset(ByRef $aData)     $aData[3] = $aData[2] EndFunc Func Scroller_Move(ByRef $aData, $iSpeed = 1)     $aData[3] -= $iSpeed     GUICtrlSetPos($aData[0], $aData[3])     If $aData[3] < -$aData[1] Then $aData[3] = $aData[2] EndFunc Func GetStringSize($string, $font, $fontsize, $fontstyle)     Local $GDIp = False     Local $iWidth = StringLen($string) * $fontsize     Local $iHeight = 2 * $fontsize     If Not $ghGDIPDll Then         _GDIPlus_Startup()         $GDIp = True     EndIf     Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int",  0x0026200A, "ptr", 0, "int*", 0)     Local $hBitmap = $aResult[6]     Local $hGrphContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)     Local $hFormat = _GDIPlus_StringFormatCreate()     Local $hFamily = _GDIPlus_FontFamilyCreate($font)     Local $hFont = _GDIPlus_FontCreate($hFamily, $fontsize, $fontstyle)     Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)     Local $aInfo = _GDIPlus_GraphicsMeasureString($hGrphContext, $string, $hFont, $tLayout, $hFormat)     _GDIPlus_FontDispose($hFont)     _GDIPlus_FontFamilyDispose($hFamily)     _GDIPlus_StringFormatDispose($hFormat)     _GDIPlus_BitmapDispose($hBitmap)     _GDIPlus_GraphicsDispose($hGrphContext)     If $GDIp Then _GDIPlus_Shutdown()     Local $aDim[2] = [Int(DllStructGetData($aInfo[0], "Width")), Int(DllStructGetData($aInfo[0], "Height"))]     Return $aDim EndFunc



Br,
UEZ

Edited by UEZ, 11 March 2012 - 09:29 PM.

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#4 Belini

Belini

    Always seeking knowledge

  • Active Members
  • PipPipPipPipPipPip
  • 390 posts

Posted 09 March 2012 - 01:43 PM

UEZ UDF excellent, how appears only in part of the screen?


imagem.JPG

Edited by Belini, 09 March 2012 - 01:44 PM.


#5 UEZ

UEZ

    Never say never

  • MVPs
  • 4,889 posts

Posted 09 March 2012 - 02:27 PM

Anybody else with same problem?

@Belini: Did you modify something?

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#6 Belini

Belini

    Always seeking knowledge

  • Active Members
  • PipPipPipPipPipPip
  • 390 posts

Posted 09 March 2012 - 02:58 PM

I tried and did not work, also the font color is not changing.

#7 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,336 posts

Posted 09 March 2012 - 03:01 PM

Anybody else with same problem?

@Belini: Did you modify something?

Br,
UEZ

Works for me on Windows 7 x64 using AutoIt V3.3.9.1.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#8 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,305 posts

Posted 09 March 2012 - 03:11 PM

I tried it on Win 7 running both AutoIt 3.3.8.1 and 3.3.9.1, using both x64 and x86 and it worked for me.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#9 UEZ

UEZ

    Never say never

  • MVPs
  • 4,889 posts

Posted 09 March 2012 - 03:46 PM

I cannot imagine what could be wrong with Belini's pc....

Thanks for testing!

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#10 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,336 posts

Posted 09 March 2012 - 04:02 PM

I guess he's using Windows XP but no idea what service pack etc...

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#11 Belini

Belini

    Always seeking knowledge

  • Active Members
  • PipPipPipPipPipPip
  • 390 posts

Posted 09 March 2012 - 07:23 PM

I tried it on Win 7 running both AutoIt 3.3.8.1 and 3.3.9.1, using both x64 and x86 and it worked for me.


Windows XP Spack2


@ UEZ do not think you understand, I want only to appear a screen part, I do not want the whole screen

The image is an example of what I want

Edited by Belini, 09 March 2012 - 07:28 PM.


#12 FaridAgl

FaridAgl

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 719 posts

Posted 09 March 2012 - 08:08 PM

The screen shot he attached was for to show you how he want it to be, he didn't said your script appears like that, he said he want it to be like that.

Edited by D4RKON3, 09 March 2012 - 08:08 PM.

I felt in love with AutoItObject [and the new Map type!].


#13 UEZ

UEZ

    Never say never

  • MVPs
  • 4,889 posts

Posted 09 March 2012 - 08:12 PM

Sorry, I misunderstood what you want to ask!

That's not easily possible because here the whole label is moving from right to left and it cannot be implemented as shown in the screenshot.

One possibility might be creating 2 topmost child windows with appropriate size and height which overlap the left and right part of the scroller.
This could give the illusion that the scroller is only in a middle part of the gui.

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#14 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,336 posts

Posted 09 March 2012 - 09:31 PM

UEZ,

I thought the same as you and probably everyone else did on the forum, that Belini had a problem with your UDF not requesting a new feature to be added.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#15 Belini

Belini

    Always seeking knowledge

  • Active Members
  • PipPipPipPipPipPip
  • 390 posts

Posted 10 March 2012 - 08:55 AM

Thank you all for your attention, the marquee did Melba23 UDF will do what I need.





Also tagged with one or more of these keywords: scroll

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users