Dummiesman Posted May 19, 2011 Share Posted May 19, 2011 I have created a scroll box of information that works fine. Because I had far more information that can fit into a variable, I had to create 15 variables to cover all the information. ie. $sScrollText1 to $sScrollText15 each with a value of lots of text. The scrolling window as it is now will scroll to the bottom of $sScrollText1 and then start over at the top again. What can I use to tell it to go to $sScrollText2 when at the bottom of $sScrollText1 and so on? The text is a total of about 3600 lines 30 characters wide. Thank you. Link to comment Share on other sites More sharing options...
Dummiesman Posted May 19, 2011 Author Share Posted May 19, 2011 I probably should show what I have in case you see a mistake or have a suggestion of a better way. $parent = GUICreate("Office 2010 ProPlus is Installing",350,450,50,50,$WS_CAPTION) GUISetBkColor(0x99cccc) GUISetFont(10,650) GUICtrlCreateLabel(" Upgrade began on " & @YEAR & "/" & @MON & "/" & @MDAY & " at " & @HOUR & ":" & @MIN & " ", 0, 30, 350, 25) GUICtrlSetFont(-1,10,650) GUICtrlSetColor(-1,0x0000ff) GUICtrlSetBkColor(-1,0x99ccff) $l = GUICtrlCreateLabel("", 20, 55, 310,210) $progress = GUICtrlCreateProgress(0, 0, 350, 30, $PBS_MARQUEE) GuiCtrlSendMsg(-1, $PBM_SETMARQUEE,True,50) GUICtrlCreateLabel(' Office 2010 Tips', -1, 265, 350, 25) GUICtrlSetFont(-1,12,650) GUISetState() $child = GUICreate('', 330, 145, 10, 290, $WS_CHILD, $WS_EX_CLIENTEDGE, $parent) GUISetBkColor(0x123456) GUISetState() $label = GUICtrlCreateLabel($sScrollText1, 0, 20, 330,500, $SS_CENTER) GUICtrlSetFont(-1, 12, 650) GUICtrlSetColor(-1, 0xffff00) GUISetState() Global $iScrollPos = -60 AdlibRegister ( "Adlib", 35 ) Func Adlib() $iScrollPos += 1 ControlMove($child, '', $label, 0, -$iScrollPos) If $iScrollPos > 500 Then $iScrollPos = -60 EndFunc Sleep(15000) Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 19, 2011 Share Posted May 19, 2011 (edited) Let's do the math: 3600 lines x 30 characters wide = 108000 TCHARs = aprox 100KB (ANSI) or maybe up to 200KB (Unicode). You don't seriously think that's too much to put in one variable do you? A string variable in AutoIt can be 2GB, though system resources on a Win32 PC might limit you to a few hundred megabytes in actual use. The limitation is much more likely to be the number of lines that can be presented in the Edit control. Look into GuiCtrlSetLimit() or _GuiCtrlEdit_SetLimit(). See help file. Edit: Add demo: #include <GuiConstantsEx.au3> #include <EditConstants.au3> Global $sScrollText1 = "", $iLine = 0, $hParent, $idEdit $hParent = GUICreate("Office 2010 ProPlus is Installing", 350, 450) $idEdit = GUICtrlCreateEdit("", 10, 10, 330, 430, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetLimit($idEdit, 640000) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case Else $iLine += 1 GUICtrlSetData($idEdit, "Line " & $iLine & ": 123456789012345678901234567890" & @CRLF, 1) EndSwitch WEnd Comment out the GuiCtrlSetLimit() to see the effect. Edited May 19, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
UEZ Posted May 19, 2011 Share Posted May 19, 2011 (edited) Something like this? expandcollapse popup#include <Array.au3> #include <GDIPlus.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "_Exit") $parent = GUICreate("Office 2010 ProPlus is Installing",350,450,50,50,$WS_CAPTION) GUISetBkColor(0x99cccc) GUISetFont(10, 650) GUICtrlCreateLabel(" Upgrade began on " & @YEAR & "/" & @MON & "/" & @MDAY & " at " & @HOUR & ":" & @MIN & " ", 0, 30, 350, 25) GUICtrlSetFont(-1,10,650) GUICtrlSetColor(-1,0x0000ff) GUICtrlSetBkColor(-1,0x99ccff) $l = GUICtrlCreateLabel("", 20, 55, 310,210) $progress = GUICtrlCreateProgress(0, 0, 350, 30, $PBS_MARQUEE) GuiCtrlSendMsg(-1, $PBM_SETMARQUEE,True,50) GUICtrlCreateLabel(' Office 2010 Tips', -1, 265, 350, 25) GUICtrlSetFont(-1,12,650) GUISetState() $child = GUICreate('', 330, 145, 10, 290, $WS_CHILD, $WS_EX_CLIENTEDGE, $parent) GUISetBkColor(0x123456) GUISetState() $fsize = 12 $fweight = 650 $fstyle = 0 $font = "Arial" Global $aText[3][2] $aText[0][0] = "Information1" & @LF & _ "This has 4 lines" & @LF & _ "This is line3:" & @LF & _ "End of information1" $aSize = GetStringSize($aText[0][0], $font, $fsize, $fstyle) $aText[0][1] = $aSize[1] + $fsize $aText[1][0] = "Information2" & @LF & _ "Only 2 lines" $aSize = GetStringSize($aText[1][0], $font, $fsize, $fstyle) $aText[1][1] = $aSize[1] + $fsize $aText[2][0] = "Information3" & @LF & _ "This is" & @LF & _ "the last information" & @LF & _ "for you" & @LF & _ "Have a good day!" & @LF & _ "Restarting information" $aSize = GetStringSize($aText[2][0], $font, $fsize, $fstyle) $aText[2][1] = $aSize[1] + $fsize $label = GUICtrlCreateLabel($aText[0][0], 0, -140, 330, 5000, $SS_CENTER) GUICtrlSetFont(-1, $fsize, $fweight, $fstyle, $font) GUICtrlSetColor(-1, 0xffff00) GUISetState() Global $iScrollPos = -140, $j = 0 AdlibRegister ( "Adlib", 35) Func Adlib() $iScrollPos += 1 ControlMove($child, '', $label, 0, -$iScrollPos) If $iScrollPos > $aText[$j][1] Then $j = Mod($j + 1, UBound($aText)) $iScrollPos = -140 ControlMove($child, '', $label, 0, -$iScrollPos) GUICtrlSetData($label, $aText[$j][0]) EndIf EndFunc While Sleep(100) WEnd Func _Exit() AdlibUnRegister("Adlib") Exit EndFunc Func GetStringSize($string, $font, $fontsize, $fontstyle) ;coded by UEZ 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 $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) 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_GraphicsDrawStringEx($hGrphContext, $string, $hFont, $aInfo[0], $hFormat, $hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) ;~ _GDIPlus_BrushDispose($hBrush) _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 May 19, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Dummiesman Posted May 19, 2011 Author Share Posted May 19, 2011 I broke it into 15 variables because when I did CTRL+F5 to check the code I kept getting "yacc stack overflow" errors after around 250 lines. Link to comment Share on other sites More sharing options...
UEZ Posted May 19, 2011 Share Posted May 19, 2011 Look to my previous post! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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