Niagara - Power and Beauty on Blurb

"Niagara - Power and Beauty" on Blurb and "Adelaide: Light and Stone" in Adelaide Bookstores -

Tuesday, February 26, 2013

Sendkeys Programming Alternative

Like a number of programmers, I have been disappointed that Sendkeys (the command which allows a programmer to emulate from within their code, keystrokes on a PC ) generally no longer works under Win7 due to security restictions (UAC). Although I have found it a bit flaky, I have used it for some time under WinXP when opening another program from Paradox10, to enter user name and password information as well as search criteria which is then applied. Recently my work changed our operating system to Win7 and I had to return to entering the data manually. However, you may be interested to know that I have discovered a Sendkeys emulation executable which so far seems to be more reliable than Sendkeys itself.


You need to download the skeys.exe file from Michel Claveau to your :Work directory (or where you wish to cite it) . I found it at http://www.mclaveau.com/batch/util.html#315 . The information is in French but I think it is clear enough. An example of how to code with it is at http://www.theusenetarchive.com/usenet-message-re-sendkeys-8166395.htm but here is an excerpt.

“One main difference is, that you can't use multiplier like {DOWN 4}, you'll
have to substitute this by {DOWN}, {DOWN}, {DOWN}, {DOWN}. You'll have to
start it with execute(...) from within OPAL.

Example: ... ;some code of my custom method, not shown here incl. vars declaration.
;stKeyString holds the command-string
stProgZeile=getAliasPath(":work:")+"\\skeys.exe "+stKeyString

TRY
;Parameter: const programName String [ , const wait Logical [ , const
displayMode SmallInt ] ] ) Logical
if NOT execute(stProgZeile, loWait) then fail() endIf
RETURN TRUE
onFail
errorShow()
RETURN FALSE
endTRY

HTH
Egbert”

You will note that there a few small differences in the way you code with this version of Sendkeys compared with the original… eg some of the ”abbreviations” and the multiplier issue…

My other problem needing to be solved as part of this was how to activate a check box by simulating a left mouse click… Again, many have asked this question, but I could not find the answer until reading this http://support.microsoft.com/kb/126449 . Sure enough, {Space} does the trick! I guess you all new this!

I have had no problems with this since I have had it up and running under Win7 but please let me know if you have any troubles.

Regards

Paul

No comments: