Page 1 of 1
Get statusbar text
Posted: Sun Mar 27, 2011 11:02 pm
by mx101
hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Re: Get statusbar text
Posted: Mon Mar 28, 2011 12:32 am
by IdeasVacuum
Well, if you mean the status bar text from the window of your own program, you should not need to collect it, since your app should already have the value held in a variable.......
Re: Get statusbar text
Posted: Mon Mar 28, 2011 8:05 am
by Fangbeast
mx101 wrote:hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Had to delete all the other posts, my very crappy coding. The below is a lot nicer to read
Code: Select all
;==========================================================================================================================
; Get the text from a specified statusbar and field in that statusbar
;==========================================================================================================================
Procedure.s GetStatusBarText(StatusbarNumber, FieldNumber)
; Find the length of the text to get from the specified statusbar (last parameter has to be 0)
StringBufferLength = SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXTLENGTH, FieldNumber, 0)
; Proceed only if we managed to get the length of the characters to retrieve
If StringBufferLength
; Just tell the user how many characters we are going to try to get back
Debug "String length to get is: " + Str(StringBufferLength)
; Create an empty string that is the length of the characters we are going to try to get back
StringBuffer.s = Space(Length)
; Now try to get the characters back from the statusbar in the specified field into the string buffer
SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXT, FieldNumber, @BufferString)
; Only proceed if we got any characters back
If StringBuffer.s
ProcedureReturn PeekS(@BufferString)
Else ; Return an empty string as nothing was retrieved despite the buffer length being initialised
ProcedureReturn ""
EndIf
;
Else
ProcedureReturn "There are no characters to be retrieved"
EndIf
;
EndProcedure
; Test this procedure with any program
Debug GetStatusBarText(1, 2) ; Get the text from field 2 in statusbar 1 (use constants, much better)
Re: Get statusbar text
Posted: Mon Mar 28, 2011 7:30 pm
by mx101
Fangbeast wrote:mx101 wrote:hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Had to delete all the other posts, my very crappy coding. The below is a lot nicer to read
Code: Select all
;==========================================================================================================================
; Get the text from a specified statusbar and field in that statusbar
;==========================================================================================================================
Procedure.s GetStatusBarText(StatusbarNumber, FieldNumber)
; Find the length of the text to get from the specified statusbar (last parameter has to be 0)
StringBufferLength = SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXTLENGTH, FieldNumber, 0)
; Proceed only if we managed to get the length of the characters to retrieve
If StringBufferLength
; Just tell the user how many characters we are going to try to get back
Debug "String length to get is: " + Str(StringBufferLength)
; Create an empty string that is the length of the characters we are going to try to get back
StringBuffer.s = Space(Length)
; Now try to get the characters back from the statusbar int he specified field into the string buffer
SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXT, FieldNumber, @BufferString)
; Only proceed if we got any characters back
If StringBuffer.s
ProcedureReturn PeekS(@BufferString)
Else ; Return an empty string as nothing was retrieved despite the buffer length being initialised
ProcedureReturn ""
EndIf
;
Else
ProcedureReturn "There are no characters to be retrieved"
EndIf
;
EndProcedure
; Test this procedure with any program
Debug GetStatusBarText(1, 2) ; Get the text from field 2 in statusbar 1 (use constants, much better)
hi...
thank you work great.

Re: Get statusbar text
Posted: Mon Mar 28, 2011 9:02 pm
by Fangbeast