Jump to content

How to find a blinking cursor.


aslani
 Share

Recommended Posts

Ok I have not coded anything yet but this is a new task I just received. I was automating a data entry process where I extract datas from Excel and automatically enter all the information into a database. That worked out great and now they want me to input the same information from Excel to this very old database system.

The application, as they told me, was built in Fortran. And by looking at it, I can't even use any Control functions (i.e. ControlSend()). It requires someone to actually read what's being displayed.

Right now, it relies on human interpretation to read and position the cursor on screen. What I need help on is how can I make AutoIt detect the position of the blinking cursor (i.e. The blinking cursor on the BIOS interface)?

The cursor blinks 0xFFFF7F color on 0x000080 color background (which I know will vary from one computer to another, but I'll entertain that problem when I get to that point).

I used the Au3Info Tool and the display area is Class:MS92TClass1, so basically I'll be looking for the cursor inside this area. Also Au3Info is not displaying any visible nor hidden texts in this area even there's plenty of texts, so it's like driving blindfolded. :/

I'm not sure if this is a reliable way of doing this so I'm also open for suggestions. :)

I'm currently reading in the Example Scripts just to see if I can find someone who did something similar and if you know of someone, can you kindly link me to it?

Thanks. ;)

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
Share on other sites

Ok I figured it out. :)

Here's what I did;

$wintitle = "WS92 DEFAULT.W92"
WinActivate("" & $wintitle)
WinWaitActive("" & $wintitle)
$area_display = ControlGetPos($wintitle, "", "[CLASS:MS92TClass]"); Get Class:MS92TClass1
$area_coord_l = $area_display[0] ; left coordinate relative to $area_display
$area_coord_t = $area_display[1] ; top coordinate relative to $area_display
$area_coord_r = $area_display[2] ; right coordinate relative to $area_display
$area_coord_b = $area_display[3] ; bottom coordinate relative to $area_display
$cursor_color = 0xFFFF7F ; color to find (blinking cursor)

$cursor_location = PixelSearch($area_coord_l, $area_coord_t, $area_coord_r, $area_coord_b, $cursor_color)

MsgBox(0, "Found!", "Cursor's at: (" & $cursor_location[0] & "," & $cursor_location[1] & ")")

Can't believe it's that simple. Now I'm on to the hard part. ;)

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
Share on other sites

Ok I added this to my codes to see if I can control the position of the cursor.

Opt("MouseCoordMode", 2)
MouseClick("left", 500, 213) ; I used the same coodinate of the cursor to see if the mouse will click here
Opt("MouseCoordMode", 1)

The mouse clicks somewhere else. I found that at param=2, it uses an area bigger than my $area_display, in this case, including the pseudo-menu buttons that the application have rather than the display area as I've defined.

Any suggestion?

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...