Author Topic: Controlling a browser  (Read 5468 times)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Controlling a browser
« on: January 17, 2017, 07:37:58 PM »
I'm having difficulty controlling a browser. Open the page is fine, setting focus and performing the first keypress. After that first keypress focus is lost and subsequent keypresses don't get passed to the browser. What do I need to do to keep focus on the browser and send 30 odd keypresses to it? Or, what am I doing wrong?

Run application 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -with parameters 'inara.cz/cmdr-cargo/33540' - wait until it starts -set as target
Set integer [todo] value to 0
Start Loop While : [todo] Is Less Than 35
Press Tab key and hold for 0.1 seconds and release
Set integer [todo] to [todo] plus 1
End Loop
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Controlling a browser
« Reply #1 on: January 17, 2017, 09:47:16 PM »
Without digging into it, I know that Chrome uses a slightly different method of presenting user interface than most apps.  I think there is a launcher involved... you'd  have to look at the task manager to see what's going on.  Again... just shooting from the hip here as I am being summoned to bed for the night o_O

Try what you are doing with IE or FF to see if there is a difference.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: Controlling a browser
« Reply #2 on: January 18, 2017, 02:08:58 AM »
I just try your command out. I changed it to the way I like to do it, and added a pause, because the tabs weren't all being counted on the webpage. Going by your command. You want to go to that page, and hit tab 35. That makes the tab stop at Conductive Polymers. I didn't have a lost of focus once with chrome in the process of getting this to work.

Not sure why you are losing focus. I added a couple of things to the command to help diagnose what windows title it's focusing on. Maybe you have another command or program being triggered in some way.

Run the command and then check your log, the first will tell you what title VA first, and the rest, what it's focus is the rest of the time. See if there is any difference.


Code: [Select]
Run application 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -with parameters 'inara.cz/cmdr-cargo/33540' - wait until it starts
Set small int (condition) [todo] value to 35
Pause 2 seconds
Write '[Blue] {ACTIVEWINDOWTITLE}' to log
Start Loop While : [todo] Does Not Equal 0
    Press Tab key and hold for 0.1 seconds and release
    Set small int (condition) [todo] value as decremented by 1
    Write '[Blue] {ACTIVEWINDOWTITLE}' to log
End Loop


TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Controlling a browser
« Reply #3 on: January 18, 2017, 12:38:10 PM »
ok, so explanation for this but today the code works fine with no loss of focus. Stupid computers!!!!!
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.