Here's a useful little bit of code, at least for me it is.
Say you want to set a dropdown box to a specific item. I use a "Function" to convert a key number to the list item like:
If num = 1 then
item = "Hello"
Elseif num = 2 then
item = "Goodbye"
This will allow running your main script from a driver spreadsheet(Data-Driven) approach.
Then the variable "item" can be passed to this snipit:
LBText = Window(Screen).ListBox(LB1).Property("Inner Text") ' Get ListBox Items
L = Length(LBText) ' Find the lenght of ListBox items list
L = L + 1
L1 = Length(item) ' L1 is the length of the item you want to select
doIt = 0 ' doIt is just a flag
for i = 1 to L ' The "For/Next" loop will compare the item to the item list to see if it is contained within it and sets the "doIt" flag if it finds it.
If i + L1 <= L Then
FndText = Mid(LBText, i, L1)
If FndText = item then
doIt = 1
if doIt = 1 Then...
This seems to be an effective way of doing an "Instring" function, which is not available in QAWP. Though the new "Parse" function is also very useful.
I hope this might help someone.
Success is the ability to go from one failure to another with no loss of enthusiasm.
~ Winston Churchill ~