topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 9:07 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Clicking in fields  (Read 5220 times)

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 491
    • View Profile
    • Read more about this member.
    • Donate to Member
Clicking in fields
« on: October 26, 2012, 11:54 AM »
I have an AHK routine that picks up some information and pastes it into an input field on a webpage.

What I'd like to be able to (but can't) is use some sort of keyboard shortcut that put the cursor into said textfield then hit ^v to paste the text. The reason I can't is, apparently, that the developer of the code for the relevant webpage wrote it in dotNet and (he says) there's no way to communicate back out of it to the host PC to set up a keyboard shortcut. So that's that, and all I can do is take advantage of the fact that the field never moves relative to its containing frame, pick an appropriate coordinate and click there.

There's a lot to go wrong with that approach. If IE develops a left-hand bar -- history, for instance -- we'll be clicking in the wrong place.

Can anyone suggest any other possible approaches?
-- bests, Tim

...this space unintentionally left blank.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Clicking in fields
« Reply #1 on: October 26, 2012, 01:08 PM »
You can locate the position of the text label that's usually on the left side of the input, and click a few pixels right of that? AHK or AutoIt can do that for you.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Clicking in fields
« Reply #2 on: October 26, 2012, 01:29 PM »
If you're using IE, you can use the COM interface available in AHK_L.

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 491
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Clicking in fields
« Reply #3 on: October 29, 2012, 11:34 AM »
You can locate the position of the text label that's usually on the left side of the input, and click a few pixels right of that? AHK or AutoIt can do that for you.

I know what I'm looking for on the screen but I can't work out how to find it. I thought ImageSearch was going to help but that looks more like a brute-force mechanism for finding a graphic I already have in a specified area of the screen. That's not quite what I'm trying to do: I'm trying to say "please give me the coordinates in the active window of xyz bit of text or a graphic called abc.jpg"

Do I have to use, say, FileCopy to copy a nearby graphic from the webpage, then ImageSearch to locate it? That feels clunky but I can't find anything better...?  :huh:
-- bests, Tim

...this space unintentionally left blank.
« Last Edit: October 29, 2012, 12:00 PM by oblivion »

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 491
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Clicking in fields
« Reply #4 on: October 29, 2012, 12:01 PM »
If you're using IE, you can use the COM interface available in AHK_L.
All my "too complicated" lights have come on at once. :D

I'm not a proper programmer, honest!
-- bests, Tim

...this space unintentionally left blank.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Clicking in fields
« Reply #5 on: October 29, 2012, 01:58 PM »
All my "too complicated" lights have come on at once. :D

Yeah, it's not for the faint of heart.  However, it is reliable.

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 491
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Clicking in fields
« Reply #6 on: October 31, 2012, 11:59 AM »
All my "too complicated" lights have come on at once. :D

Yeah, it's not for the faint of heart.  However, it is reliable.

My "too complicated" lights have continued to blink, at least intermittently. However, I've done pretty much what I said I'd do if I couldn't find anything simpler: I've downloaded a graphic that sits directly above the input field using UrlDownloadToFile, then used ImageSearch to provide its coordinates, which I then add a bit to and feed to Click.

It still feels clunky. But what the heck, it works -- and I don't have to try to decode what's going on at COM level, which can only be a bonus. :)

Thanks, both!
-- bests, Tim

...this space unintentionally left blank.