Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to detect coloured row with vb

Status
Not open for further replies.

Bileygr

Technical User
Feb 28, 2015
7
IT
Hello, I am trying to find a way to operate on highlighted rows/strings.
I work with hierarchical db on mainframe, thus the command "find something" is essential for my job. When a string match, the system highlight it in red. Is there a way to tell vb to place the cursor on/before/after the highlighted string?

Thanks
 
Hi,

I think I asked someone lately who posted a similar request, what does Extra VB HELP have to say about the Selection object. Have you checked that out?

So when I did stuff like this, the user wanting to "find something" didn't just want to "find something" one time and the some other user wanted to "find something else" from the same screen.

So I ended up scraping EVERYTHING from each screen and putting ALL that data into an Excel sheet for ALL the items that the user wanted "Something" or "Something else".

Bottom line, I never just got one thing from a screen. Got the whole thing, parsed it and wrote to Excel table.

So I'd assign the text on the screen to a string, then find in the string, perhaps.
 
Thank you very much for your reply. I don' t need to find something to parse it and copy it to excel, I need to find things and operate on them directly in the mainframe file.
The find command I use it' s not a vb command, it's a command embedded in the mainframe program I use to manage the db I work with. The result of that command is that the lines containing a matching string get highlighted, once at a time from beginning of file, and you can move to the next occurrence with pf12.
All I need is a way to make vb detect coloured string, just like excel where you can filter and search for cells/rows/columns formatted in a particular fashion.
 
If it's in the mainframe, then it has nothing to do with Attachmate, which is a terminal EMULATOR.
 
My aim is not to create a macro which interacts with the find command issued in mainframe, I know it is not possible to do so, i.e. I cannot issue the find command (in mainframe) and tell visual basic to act on the found string, because it can' t be aware of the exit status of a mainframe command. I was looking for a workaround to that limitation; since the result of the find command is to turn the string containing matching pattern to red, telling visual basic to place cursor on the first red character on screen would give me the same result, but I don' t know how to let vb search for matching colour instead of a matching character.
 
I could be wrong, but on. 3270 terminal when the mainframe paints the screen, the space before a field contains an ESCAPE CHARACTER.

You'll need to experiment to discover if this is the case and has any significant.
 
How can I make an eventual escape character visible?
 
You take that character and use the Asc() function to display the ASCII value of that character.
 
I have no escape character near the coloured row. I' ve tried with a cut and paste of the coloured line on a text document but nothing strange appeared near the pasted text.
I have also tried pasting in excel, it gives you the possibility to paste as bitmap image, csv, unicode text, but it doesn' t preserve formatting, the text is pasted in black despite of its original colour in extra
 
Look at "AttributeBackground" or "AttributeForeground" property in the HELP files.
this is only available for VAX/VMS, UNIX, or asynchronous host. It is not available for IBM AS/400 or IBM Mainframe. :-(
If someone can get this to work, Please, please post the code..
Code:
Description

The properties in this group affect how the screen displays colors. You can use these properties to change the colors displayed on your screen and to add color to the text in your display window by assigning (mapping) the various character attributes and their combinations to different colors. They are equivalent to the options on the page Settings, Display, Color or Settings, Colors.

Syntax

Unless noted, all color-related properties have the following syntax:

object.Property

Element	Description
Object	The HostOptions object.
Property	A color-related property.
Names and Descriptions of individual properties
AttributeForeground Property and AttributeBackground Property

Returns or sets the foreground and background color mapped to a particular attribute or combination of attributes. 



colorindex = object.AttributeForeground(attribute)
object.AttributeForeground(attribute) = colorindex

colorindex = object.AttributeBackground(attribute)
object.AttributeBackground(attribute) = colorindex


Element	Description
Object	The HostOptions object.
attribute	A value from the following table indicating which attribute or combination of attributes to which you are referring.
colorindex	The color which is displayed for characters or their backgrounds which have that attribute or combination of attributes. The color is represented as a color index, 0 to 15.  
Use the following constants to indicate a particular combination of attributes.

Constant	Value
XAttributeNormal	0
XBlink	8
XBlinkBold	9
XBlinkInverse	12
XBlinkInverseBold	13
XBlinkInverseUnderline	14
XBlinkInverseUnderlineBold	15
XBlinkUnderline	10
XBlinkUnderlineBold	11
XBold	1
XHistory	16
XInverse	4
XInverseBold	5
XinverseUnderline	6
XInverseUnderlineBold	7
XUnderline	2
XUnderlineBold	3
Color Property

Returns or sets the RGB (Red, Green, Blue) value for a particular color in the array of 16 VT colors. 

RGBvalue = object.Color(colorindex)
object.Color(colorindex) = RGBvalue

Element	Description
Object	The HostOptions object.
colorindex	A number 0 to 15 indicating the VT color index to which you are referring.   
RGBvalue	The actual color which is displayed for that VT color index. The value is calculated as Red*65536 + Green*256 + Blue.
ISOColor Property

Returns or sets whether received ISO color sequences have any effect. Set this property TRUE to recognize ISO color sequences. The host uses ISO color sequences to control foreground and background colors independently of other visual attributes. 

LockUserColors Property

Returns or sets whether to prevent the host from changing colors. Set this property TRUE to prevent the host from changing colors. Normally the host can change any of the 16 colors defined by the display. However, some host applications fail to restore the colors, altering the appearance of text and graphics from other applications. 

MapColorBlink Property

Returns or sets whether to map the Blink attribute to color. Set this property TRUE to map colors to characters with the blink character attribute. 

MapColorBold Property

Returns or sets whether to map the Bold (or in a Wyse session, Dim) attribute to color. Set this property TRUE to map colors to characters with the bold character attribute.

MapColorInverse Property

Returns or sets whether to map the Inverse attribute to color. Set this property TRUE to map colors to characters with the inverse character attribute.

MapColorUnderline Property

Returns or sets whether to map the Underline attribute to color. Set this property TRUE to map colors to characters with the underline character attribute

ResetAttributes Method

Reset the foreground and background attribute mappings to factory values. It does not change the RGB combination currently used for each color index. 

ResetColors Method

Resets the RGB combination used for each color index to factory values.   

UseExactColors Property

Returns or sets whether to give EXTRA!/KEA! exact control over the colors it displays. This option is available only if you have a 256 color display (that is, a display with a palette). Set this property TRUE to make 16 of the 256 available colors exactly match the VT colors. You can change any of the 16, defining your own exact colors. Set this property FALSE to disable the palette. The requested color is matched to the closest available Windows pre-set color.  

© 1996 - 2004, Attachmate Corporation. All rights reserved.
 
Unfortunately I work on a Z/os mainframe... I have been wondering about a solution to the problem of catching colours form screen. Copying text is possible by means of a default macro which uses a proper API. Do you think that an API for pulling format out of the framebuffer could exist as well?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top