ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Autohotkey robots

(1/2) > >>

oblivion:
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!)

MilesAhead:
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:
Along with the AHK experts here I would also ask on AHK Forums-MilesAhead (July 04, 2023, 01:12 PM)
--- End quote ---
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. 
--- End quote ---
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!)

MilesAhead:
Have done. I thought I'd ask here first -- where everyone is utterly lovely -- in case I was being extremely stupid. 
-oblivion (July 05, 2023, 04:35 AM)
--- End quote ---

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:
Hmmm, I am not sure if that's a left-handed insult or compliment. -MilesAhead (July 05, 2023, 03:03 PM)
--- End quote ---
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:  :-[

Navigation

[0] Message Index

[#] Next page

Go to full version