Sign in to follow this  
Followers 0
hezi

create updated massage board

5 posts in this topic

hi,

i'm trying write script that take lines from file and display them on read only editbox ( GUICtrlCreateEdit).

the script is working for me but i have some issues:

when i dont use delay (sleep) the gui flicks and if i use it i cant close the GUI unless i click the close button several times.

what i'm doing wrong?

any idea?

any suggestions?

any sample code you can provide?

thanks in Advance.

Share this post


Link to post
Share on other sites



Difficult to say without example code.

thanks for the reply.

#include <GuiEdit.au3>

#include <GuiStatusBar.au3>

#include <GuiConstantsEx.au3>

;Opt('MustDeclareVars', 1)

;$Debug_Ed = True ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

#include <Constants.au3>

#Include <File.au3>

#Include <Array.au3>

FileDelete("c:\temp\session.txt")

RunWait("c:\temp\plink.exe -pw q -ssh root@x.x.x.x find / -type f -size +2000k -exec ls -lh {} \; |grep xxx >c:\temp\session.txt")

_Main()

Func _Main()

Local $hEdit, $hGUI

Local $sFile = "C:\tmp\session.txt"

;Local $aPartRightSide[4] = [120, 248, 378, -1]

; Create GUI

$hGUI = GUICreate("Edit Set Read Only", 600, 100)

$hEdit = GUICtrlCreateEdit("", 1, 1, 599, 100)

GUISetState()

; Set Margins

_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

While 1

if GUIGetMsg() = $GUI_EVENT_CLOSE then exit

sleep(100)

_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Set Read Only

_GUICtrlEdit_SetReadOnly($hEdit, True)

if GUIGetMsg() = $GUI_EVENT_CLOSE then exit

;sleep(100)

WEnd

GUIDelete()

EndFunc ;==>_Main

im very new in this so forgive me if the code is mess...

basically i want to make gui that display the results i get from linux machine (it should update every 1-2 seconds).

if you have better way to do that i will be glad to know.

Thanks in advance.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

since the only 'IF' you have is $GUI_EVENT_CLOSE make that the only item in the loop, set the text just prior

_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
; Set Read Only
_GUICtrlEdit_SetReadOnly($hEdit, True)

While 1

if GUIGetMsg() = $GUI_EVENT_CLOSE then exit


WEnd

GUIDelete()
EndFunc ;==>_Main
Edited by iamtheky

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

Share this post


Link to post
Share on other sites

since the only 'IF' you have is $GUI_EVENT_CLOSE make that the only item in the loop, set the text just prior

_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
; Set Read Only
_GUICtrlEdit_SetReadOnly($hEdit, True)

While 1

if GUIGetMsg() = $GUI_EVENT_CLOSE then exit


WEnd

GUIDelete()
EndFunc ;==>_Main

thanks!

but if i do what you suggested the gui will not updated with new data. i need him to display new data.

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