6atman Posted May 10, 2012 Share Posted May 10, 2012 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 Link to comment Share on other sites More sharing options...
iamtheky Posted May 10, 2012 Share Posted May 10, 2012 (edited) The math is off on the spacing on the GUI, im sure someone can fancy that up. expandcollapse popup#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 May 10, 2012 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 10, 2012 Moderators Share Posted May 10, 2012 6atman, Welcome to the AutoIt forum (for a second time). I would do it like this: expandcollapse popup#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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now