topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday December 3, 2024, 2:50 pm
  • 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: Autohotkey robots  (Read 7398 times)

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Autohotkey robots
« on: July 04, 2023, 09:10 AM »
Hi all :)

I've written an automation process in autohotkey. It takes a file (that's automatically generated elsewhere at 6pm every day), cleans a copy of it up then uses that as a set of inputs to a Windows program that has no ability to be batch-fed data.

It works pretty well -- the file cleanup element does its thing as it should, the Windows program it invokes gets started and the right part of the program opened and the input data fed to it an element at a time, each requiring a little routine of keypresses and mouse clicks. All exactly as intended. I was thoroughly pleased with myself when it worked -- fine-tuning delays between parts of the automated process took some time and when it all came together, I had a great feeling of accomplishment.

So why am I here? Well -- I want it to run on its own, on a virtual PC. But when I set it off automatically (using task scheduler), the only part of the process that happens is the file cleanup and the invocation of the program that's going to be manipulated. Anything that requires the simulation of user interaction with a program just doesn't happen.

I can make guesses why -- there's no desktop being created, no attached screen being written to, things like that, if you're going to issue "click at this pixel" instructions when there's no session being displayed anywhere, that's maybe going to confuse things.

So ... am I trying to do the impossible? Or is there a way to programmatically create the screen, mouse and keyboard that would be there if I'd RDPed to the machine, even though I haven't? Or have I misunderstood the nature of the problem?

(This feels a bit like a version of the "if a tree falls in the forest and there's nobody there to see it" paradox!)
-- bests, Tim

...this space unintentionally left blank.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Autohotkey robots
« Reply #1 on: July 04, 2023, 01:12 PM »
Along with the AHK experts here I would also ask on AHK Forums

I haven't decided if I will learn V2.x yet.  But anyway I am sure Lexicos could give you some pointers.  At least in version 1.x AHK accessed the hardware directly by default.  Likely there are ways to stipulate avoiding that approach.  But AHK 2.x has made radical changes dumping the backward compatibility shackles etc..  Lexicos is the person who implemented all or most of them so going right to the source is always advisable.   8)

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Autohotkey robots
« Reply #2 on: July 05, 2023, 04:35 AM »
Along with the AHK experts here I would also ask on AHK Forums
Have done. I thought I'd ask here first -- where everyone is utterly lovely -- in case I was being extremely stupid.  :D

I haven't decided if I will learn V2.x yet. 
I was intuitively sure my code wasn't complex enough to fail to work in either, but it would only compile in v1 so it looks like I have some learning to do too! (I think #NoEnv is now the default so isn't required, and I think v2 didn't like my read loops so I suspect some syntactical changes there too, but at the point of compilation it didn't seem important to acquire v2 compatibility so I didn't bother trying to fix it!)
-- bests, Tim

...this space unintentionally left blank.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Autohotkey robots
« Reply #3 on: July 05, 2023, 03:03 PM »
Have done. I thought I'd ask here first -- where everyone is utterly lovely -- in case I was being extremely stupid. 

Hmmm, I am not sure if that's a left-handed insult or compliment.  It sort of implies there are empathetic stupid people hereabouts who can at least commiserate about the problem if not solve it.  Heh heh heh   ;D ;D ;D

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Autohotkey robots
« Reply #4 on: July 06, 2023, 04:34 AM »
Hmmm, I am not sure if that's a left-handed insult or compliment.
Definitely a compliment.  ;D My use of Autohotkey to solve some really awkward problems over the last few years wouldn't have got off the ground without the DC community, even if much of the time it's just been me looking at other people's code and consequently standing on the shoulders of giants.  :Thmbsup:  :-[
-- bests, Tim

...this space unintentionally left blank.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Autohotkey robots
« Reply #5 on: July 06, 2023, 09:10 AM »
Hmmm, I am not sure if that's a left-handed insult or compliment.
Definitely a compliment.  ;D My use of Autohotkey to solve some really awkward problems over the last few years wouldn't have got off the ground without the DC community, even if much of the time it's just been me looking at other people's code and consequently standing on the shoulders of giants.  :Thmbsup:  :-[


Nicely said.  Yesterday I looked at some of the differences between 1.x and 2.x.  I realized that I completely misunderstood when I read the same material some years ago.  I guess the only thing for me to do is write something trivial and see what happens.  Somehow I got the impression in the past that the whole comma delimited syntax was befing discarded.  I don't know why I got that idea but it sort of discouraged me from looking at 2.x.  So I should be thanking you for causing me to discover my error..  :Thmbsup: