Sign in to follow this  
Followers 0
LordSphynx

Automatic Scrolling of the edit window

7 posts in this topic

I have made a little program with a console view. You can see it hereunder.

Posted Image

Could someone tell me how I can make the console view scroll automatically ?

For the moment (and you can see it on the image), text is displayed from up to down, but when it reaches the end of the frame, it goes further but I have to scroll with the navigation bar on the right. I would like that the text continues to automaticly display, leaving the text that is above it, scroll ...

Thanks !

Share this post


Link to post
Share on other sites



How about using $ES_AUTOVSCROLL style



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Currently I have this:

output = GuiCtrlCreateEdit("Console" & @CRLF, 0,200,400,175,$ES_AUTOVSCROLL + $ES_MULTILINE + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE)

So the autovscroll is included

Share this post


Link to post
Share on other sites

Maybe post my whole script :

#include <GuiConstants.au3>
#include <File.au3>
TCPStartup()
SplashImageOn("", "C:\UTILS\DiskMonitor-FKA\img\DM_splash_v2.bmp", 508, 154,-1,-1,1)
Sleep(3000)
SplashOff()
;Check if user wants to edit the config file.
If Not IsDeclared("inMsgBoxAnswer") Then Dim $inMsgBoxAnswer
        $inMsgBoxAnswer = MsgBox(68,"Serverlist needed !","Do you want to edit the serverlist?")
        If $inMsgBoxAnswer == 6 Then Run('Notepad.exe C:\UTILS\DiskMonitor-FKA\config\servers.txt', @TempDir, @SW_MAXIMIZE)
$answerLogin = InputBox("Disk Monitoring v2.0","Please Enter Your Privileged Username (NO DOMAIN !)")
$answerPass = InputBox("Disk Monitoring v2.0", "Please Enter Your Privileged Password","","*")
$answerDomain = InputBox("Disk Monitoring v2.0", "Please Enter The Domain")
TrayTip("Disk Monitoring v2.0","Busy ...","18000",1)
;$answer = InputBox ("DriveMonitor 1.0 by Frederic Kaye", "Please enter the servername you wish to check.")

If FileExists ("C:\TEMP\DiskMonitoring\log.txt") Then
    FileDelete ("C:\TEMP\DiskMonitoring\log.txt")
    FileInstall("log.txt", "C:\TEMP\DiskMonitoring\log.txt", 1)
Else
    DirCreate("C:\TEMP\DiskMonitoring")
    FileInstall("log.txt", "C:\TEMP\DiskMonitoring\log.txt", 1)
EndIf
$LogFile = FileOpen("C:\TEMP\DiskMonitoring\log.txt", 1)
FileWriteLine($LogFile, "Disk Monitoring v2.0 (GLOBAL)")
FileWriteLine($LogFile, "*************************************")
FileWriteLine($LogFile, "These are the results of the Disk Monitoring:")
FileWriteLine($LogFile, "")

$ServerList = FileOpen("C:\UTILS\DiskMonitor-FKA\config\servers.txt", 0)
;Check if file is open
If $ServerList = -1 Then
    MsgBox(0, "Error", "Unable to open ServerList file.  Please check if servers.txt exists.")
    Exit
EndIf

GuiCreate("DriveMonitor v2.0 - by Frederic Kaye", 400, 450,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$output = GuiCtrlCreateEdit("Console" & @CRLF, 0,200,400,175,$ES_AUTOVSCROLL + $ES_MULTILINE + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE)

$Pic1 = GuiCtrlCreatePic("C:\UTILS\DiskMonitor-FKA\img\DM_small.bmp", 100, 20, 205, 154)
$font = "Comic Sans MS"
$LogMessage = GuiCtrlCreateLabel("When finished, close this window to display the log.",100,420,400,175)
GuiSetState()
While 1
    $server1 = FileReadLine($ServerList)
    If @error = -1 Then ExitLoop

; Check C DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\C$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive C has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive C has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

; Check D DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\D$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive D has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive D has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

; Check E DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\E$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive E has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive E has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

; Check F DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\F$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive F has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive F has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

; Check G DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\G$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive G has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive G has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

; Check H DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
$serverip = TCPNameToIP($server1)
DriveMapAdd ("B:", "\\" & $serverip & "\H$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var3 = DriveSpaceFree("B:\")
$varF = Round($var3,2)
$var7 = DriveSpaceTotal("B:\")
$varF_Total = Round($var7,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive H has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive H has " & $varF & " MB free of " & $varF_Total & " MB.")
DriveMapDel("B:")
RunAsSet()

;Check I DRIVE
RunAsSet ($answerLogin, $answerDomain, $answerPass, 2)
DriveMapAdd ("B:", "\\" & $serverip & "\I$", 0, $answerDomain & "\" & $answerLogin, $answerPass)
$var4 = DriveSpaceFree("B:\")
$varG = Round($var4,2)
$var8 = DriveSpaceTotal("B:\")
$varG_Total = Round($var8,2)
GUICtrlSetData($output, GUICtrlRead($output) & "Server " & $server1 & " (" & $serverip & ") drive I has " & $varF & " MB free of " & $varF_Total & " MB." & @CRLF)
FileWriteLine($LogFile, "Server " & $server1 & " (" & $serverip & ") drive I has " & $varF & " MB free of " & $varF_Total & " MB.")
FileWriteLine($LogFile, "")
DriveMapDel("B:")
RunAsSet()

WEnd
GuiCtrlSetData($output, GuiCtrlRead($output) & "Operation completed successfull !")
TrayTip("Disk Monitoring v2.0","",0)
TrayTip("Disk Monitoring v2.0","Done ! Close the windows to display the Log!",18000)
FileClose($Serverlist)
FileClose("C:\TEMP\DiskMonitoring\log.txt")
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(68,"Disk Monitoring Complete!","Do you want to display the Log File?")
        If $iMsgBoxAnswer == 6 Then Run('Notepad.exe C:\TEMP\DiskMonitoring\log.txt', @TempDir, @SW_MAXIMIZE)
    

Exit

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Changing GUICtrlSetData to something like below, seems to do the trick.

For $i = 1 To 30
    GUICtrlSetData($output, "This is test " & $i & @CRLF, GUICtrlRead($output))
    Sleep(150)
Next
Edited by Joon

Share this post


Link to post
Share on other sites

Use _GUICtrlEdit_AppendText()

It's what I was going to say <_<

This function is in the beta. It appends text as it scrolls.

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