Joe Strazzere - All Things Quality

Visit my new blog at http://strazzere.blogspot.com/


August 11, 2008 - WinTask - Getting Properties of Objects

Posted in WinTask

When using WinTask as a test tool, we often want to get a property (text, selection, etc) from an object.  Here are some methods to do so.

 

 

'
' Getting Properties (text, etc) from various objects
'
' Author: Joe Strazzere


 

'-------------------------------------------

'
' Get Text from a multiline edit box
'
result_capture$ = Capture$("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1,1)

'
' Get Text from an edit box
'
result_capture$ = Capture$("NOTEPAD.EXE|Edit|Find|1",1,1)

 

'-------------------------------------------

'
' Get Seletion from a ComboBox
'
result_capture$ = Capture$("NOTEPAD.EXE|ComboBox|Font|5",1,1)

'
' Get the text from a ComboLBox
'
result_capture$ = Capture$("NOTEPAD.EXE|ComboLBox|Font|1",1,1)

'
' Get the text from a Static field
'
result_capture$ = Capture$("NOTEPAD.EXE|Static|Microsoft ® Notepad",1,1)

'
' Get the text from a SysListView32 control
'
result_capture$ = Capture$("NOTEPAD.EXE|SysListView32|FolderView",1,1)

 

'-------------------------------------------

'
' Get the nth item from a ComboBox
'
var$ = ListItem$("NOTEPAD.EXE|ComboBox|Page Setup|1",2)

'
' Get the nth item from a Listbox
'
var$ = ListItem$("NOTEPAD.EXE|ListBox|About|1",2)

 

'-------------------------------------------

'
' Get the Selected item from a ComboBox
'
var$ = SelectedItem$("NOTEPAD.EXE|ComboBox|Page Setup|1")

'
' Get the nth item from a Listbox
'
var$ = SelectedItem$("NOTEPAD.EXE|ListBox|About|1")

 

'-------------------------------------------

'
' Check for the existence of a given window
'
ret = ExistW("NOTEPAD.EXE|Button|OK")

 

'-------------------------------------------

'
' Determine if a Checkbox is checked or not
'
ret = CheckedW("NOTEPAD.EXE|Button|Match &case")

'
' Determine if a Radio Button is checked or not
'
ret = CheckedW("NOTEPAD.EXE|Button|P&ortrait")

 

'-------------------------------------------

'
' Determine if a given window is enabled or not
'
ret = EnabledW("NOTEPAD.EXE|Button|&Find Next")


 



Any comments on this article?
Email Me


<- Last Page :: Next Page ->

About Me

A gathering place for information and ideas about Quality Assurance, Testing, and other useful topics.

Problems cannot be solved by the same level of thinking that created them. - A. Einstein

Search This Site

Translate This Site

RSS Feed

Subscribe

Twitter

@jstrazzere

Categories

Life
QA
Sports
Tools
WinTask
Work in General

What I'm Reading Now