Sign in to follow this  
Followers 0
6atman

Marquee Message Kiosk

3 posts in this topic

I am working on creating a kiosk that will read a text file line by line and scroll each line across the screen. I am doing this so that we (IT Dept) can post messages that affect all of our branches (sending emails does not work, they won't check it, and we are getting multiple reports of the same issue.) I have been able to get the script to read the file and post the marquee but I am having trouble figuring out how to make it check to see if there is a second line, and if there is, create another marquee below the first one. I hope to have it so that, as we resolve issues, we can remove the line from the file and the corresponding marquee will disappear. I am using Melba23's marquee UDF (Saved me a MAJOR headache by the way.) I have been using AutoIt for a while now but have mostly been able to figure things out on my own. So far I have this

#include <Marquee.au3>
HotKeySet("{ESC}", "Terminate")
;==>Terminate
Func Terminate()
    Exit 0
EndFunc
;Open message log
$file = FileOpen("Test.txt", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

;Create window
GUICreate("IT Messages", @DesktopWidth, @DesktopHeight)
GUISetBkColor(0xFFFFFF)


$message = FileReadLine($file)
If @error = -1 Then $message = "END"
_GUICtrlMarquee_SetScroll(Default, "scroll", Default, 6, 5)
_GUICtrlMarquee_SetDisplay(0, "blue", "white", 35, "arial")
_GUICtrlMarquee_Create($message, 10, 10, @DesktopWidth, 55)
GUISetState()
While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The math is off on the spacing on the GUI, im sure someone can fancy that up.

#include <Marquee.au3>
#Include <File.au3>
#Include <Array.au3>

HotKeySet("{ESC}", "Terminate")
;==>Terminate
Func Terminate()
    Exit 0
EndFunc
;Open message log
$file = FileOpen("Test.txt", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

;Create window
GUICreate("IT Messages", @DesktopWidth, @DesktopHeight)
GUISetBkColor(0xFFFFFF)

Global $Farray
_FileReadToArray ("test.txt", $Farray)
;~ _ArrayDisplay($Farray)



If @error = -1 Then $message = "END"
_GUICtrlMarquee_SetScroll(Default, "scroll", Default, 6, 5)
_GUICtrlMarquee_SetDisplay(0, "blue", "white", 35, "arial")

For $i = 1 to $Farray[0]
If $i = 1 then
_GUICtrlMarquee_Create($Farray[$i], 10, 10, @DesktopWidth, 55)
else
_GUICtrlMarquee_Create($Farray[$i], 10, ($i - 1) * 65, @DesktopWidth, 55)
Endif
next

GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

6atman,

Welcome to the AutoIt forum (for a second time). ;)

I would do it like this: :D

#include <GUIConstantsEx.au3>
#include <File.au3>
#include <Marquee.au3>

HotKeySet("{ESC}", "Terminate")

Global $aLines

; Read message log into an array
_FileReadToArray("Test.txt", $aLines)
If @error Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

;Create window
GUICreate("IT Messages", @DesktopWidth, @DesktopHeight)
GUISetBkColor(0xFFFFFF)

; Now loop thoough the array seeting a new marquee for each line
For $i = 1 To $aLines[0]
    _GUICtrlMarquee_SetScroll(Default, "scroll", Default, 6, 5)
    _GUICtrlMarquee_SetDisplay(0, "blue", "white", 35, "arial")
    ; Move each line down by one line height
    _GUICtrlMarquee_Create($aLines[$i], 10, 10 + (55 * ($i - 1)), @DesktopWidth, 55)
Next

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

All clear? Please ask if not. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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