Kyme Posted April 25, 2019 Share Posted April 25, 2019 Hello Guys I want to make a scroll text and send it to a lcd, I've managed the connection and be able to display it but i faced the "too much chars to be displayed" problem, so i need to create a function to scroll the text, the problem is that i have no idea how can i get the first char and put it last if the string it's too big and if not then let it as it is Can anybody give me an idea where can i start? Thank you Link to comment Share on other sites More sharing options...
RTFC Posted April 25, 2019 Share Posted April 25, 2019 example My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 25, 2019 Moderators Share Posted April 25, 2019 Kyme, RTFC took the words from right out of my mouth! 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...
RTFC Posted April 25, 2019 Share Posted April 25, 2019 Truly, I feel blessed today, as for once in my life I was faster than the black double goose-tailed winged dragon-griffon beasty lying in a bowl of red chilli (or whatever it is). FrancescoDiMuro and jchd 2 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 25, 2019 Moderators Share Posted April 25, 2019 RTFC, It is a chimera - in this specific case the badge of one of my previous units. M23 FrancescoDiMuro, RTFC and seadoggie01 3 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...
Kyme Posted April 25, 2019 Author Share Posted April 25, 2019 (edited) 2 hours ago, RTFC said: example Thank you for fast response i saw the script prior posting and as i understood it's a gui thing, i need a string format i have a function that require a string to print it on lcd, can be used marquee to create a same size string as original one but rotating?maybe i've missed something, i could make a function to subtract the max-1 both sides and concatenate them and trim it to @30 chars, but it sounds painful and i guess it's harder then it sounds. My small project it's to make a lcd app to print song name that's playing on spotify. Till now i've managed to do the displaying but i want the text to be on 1 line only, and if the title it's longer then to scroll the text. Edit: this is what i'm come up to, is there any other more elegant solution, it looks sooo trivial... $title="Adelitas Way - What It Takes"&" " ;31 $max=10 while 1 $title=title($title) ConsoleWrite(StringTrimRight($title,Int(StringLen($title))-$max)&@CRLF) Sleep(100) WEnd Func title($otitle) local $o_title=$otitle local $size=StringLen($o_title) local $char=StringTrimRight($o_title,$size-1) local $title_subed=StringTrimLeft($o_title,1) $first=StringTrimLeft($o_title,1) ;ConsoleWrite($title_subed&$char&@CRLF) Return $title_subed&$char EndFunc Edited April 25, 2019 by Kyme Link to comment Share on other sites More sharing options...
jchd Posted April 25, 2019 Share Posted April 25, 2019 Try this and adapt: HotKeySet("{ESC}", _Terminate) Local $title = "Adelitas Way - What It Takes" & " here more long text, much larger than LCD 24-char display (example) ... " Local $max = 24 Local $str = $title & $title ; yes, concat two copies of text Local $i While 1 $i += 1 ConsoleWrite(StringMid($str, Mod($i, StringLen($title)), $max) & @CRLF) Sleep(200) WEnd Func _Terminate() Exit EndFunc Kyme 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Gianni Posted April 25, 2019 Share Posted April 25, 2019 (edited) ...rotate a string left or right by a wanted num of chars expandcollapse popup#include <GUIConstantsEx.au3> Local $sString = "I want to make a scroll text and send it to a lcd, I've managed the connection and be able to display it but i faced the ""too much chars to be displayed"" problem " & ChrW(9786) & " " & ChrW(9829) & " " Local $iLCD_Len = 24 GUICreate("LCD", 400, 30) $hLCD = GUICtrlCreateLabel("", 0, 0, 400, 30) GUICtrlSetFont(-1, 20, 400, 0, "Courier New") GUICtrlSetBkColor(-1, 0x550000) GUICtrlSetColor(-1, 0xff0000) GUISetState() While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect ControlSetText('', '', $hLCD, StringLeft($sString, $iLCD_Len)) $sString = _StringRotate($sString, -1) Sleep(100) WEnd GUIDelete() ; rotate a string by a nr of chars ; negative number rotate left <-- , positive number rotate right --> Func _StringRotate($sString, $sStep = -1) Local $Len = StringLen($sString) Local $bROL = $sStep < 0 $sStep = Mod(Abs($sStep), $Len) If $bROL Then Return StringRight($sString, $Len - $sStep) & StringLeft($sString, $sStep) Else Return StringRight($sString, $sStep) & StringLeft($sString, $Len - $sStep) EndIf EndFunc ;==>_StringRotate Edited April 25, 2019 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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