Sign in to follow this  
Followers 0
Thrain

autiit vs sendkeys

15 posts in this topic

I am having some reliability issues with my sendkey commands. As of right now, I grab window focus, use sendkey commands, and let go of window focus. Yet, occasionally my sendkeys commands get screwed up.

Is autoit more reliable than sendkeys? just curious if anyone has similar experiences.. thx!

Share this post


Link to post
Share on other sites



I am having some reliability issues with my sendkey commands. As of right now, I grab window focus, use sendkey commands, and let go of window focus. Yet, occasionally my sendkeys commands get screwed up.

Is autoit more reliable than sendkeys? just curious if anyone has similar experiences.. thx!

sendkeys blows chunks, and sauce............ :o

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

****quick question*****

what exactly is 'sendkeys'?


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

sendkeys blows chunks, and sauce............ :o

agreed. So far, sendkeys are the only way I have used automated keyboard commands.

Share this post


Link to post
Share on other sites

Is autoit more reliable than sendkeys? just curious if anyone has similar experiences.. thx!

Absolutely. If it can be automated, then AutoIt would be your best chance of doing it.

****quick question*****

what exactly is 'sendkeys'?

VBScript using Sendkeys:

Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.Run "notepad"
WScript.Sleep 3000
oShell.AppActivate "Untitled"
oShell.SendKeys "This is Sendkeys using the Windows Scripting Host"

AutoIt using ControlSend

Run('notepad')
WinWait('Untitled')
ControlSend('Untitled', '', 'Edit1', 'This is ControlSend using AutoIt')

If the window becomes inactive in either of the above scripts, Sendkeys would fail but AutoIt would succeed as AutoIt can send to the control directly with Control*() functions. WSH does not have the good range of Win*() functions that AutoIt has so WSH is blind with it's Sendkey's operation.

Share this post


Link to post
Share on other sites

MHz,

Thank you! That is very helpful information. The loss of window focus is most likely the cause of my problem. AutoIT to the rescue :o

Share this post


Link to post
Share on other sites

ohhh hehe, didnt even think about VBS's sendkeys command


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

well... it appears that ControlSend can't send "alt" to the window, which is actually something I need to do ;(

So..if I use the autoit send method, I still run the risk of loosing window focus in the middle of my send command, just like vb sendkeys, right?

hmm...

Share this post


Link to post
Share on other sites

There are ways... A ControlSendPlus() UDF (User Defined Function) exists in the forum somewhere... it may handle Alt keys... or you would need to

Send("{ALTDOWN}")

; that sets the Alt key modifier

ControlSend...

Send("{ALTUP}")

Although... now that I think about it... doesn't the ! work... that is...

ControlSend("title","whatever text","ControlNN","!e")

; would send ALT + e

right?

Lar.

According to the help file

Remarks

ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window.

ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

interesting. I think the ControlSendPlus() UDF will do the trick. However, I have never used a UDF before. I am using AutoITX with COM interface in my vb.net project. I'm alittle clueless as to how I would reference a UDF. thx!

Share this post


Link to post
Share on other sites

interesting. I think the ControlSendPlus() UDF will do the trick. However, I have never used a UDF before. I am using AutoITX with COM interface in my vb.net project. I'm alittle clueless as to how I would reference a UDF. thx!

Yahoo! Are you a converted member now?


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

converted member ;D ? I am converting all my automation tasks to AutoITX right now. does that count?

BTW. I was able to to figure to that I need to create ControlSendPlus.au3 in my autoit3\include folder.

now that I have done that, is there something else I need to do?

I'm alittle concerned about deployment issues as I will need to use this automation on a series of machines. Right now, using vb.net, all I need is to ensure that all the machines have the .net 2.0 framework.

using autoitX com, I will need to register the AutoItX3.dll on all the machines. that is certainly simple enough. However, what else will I need to do in order to use UDFs on all the machines ;D

Share this post


Link to post
Share on other sites

all you need... woo... you should be easy to please...

you may consider that if you write your automation completely to AutoIt Script... you could compile it into a 120k - 200k standalone EXE. This exe can go whereveer Windows goes.

Lar.

well, I have .net framework on all the machines. I've written & deployed all the custom reg files/logon scripts/GPO etc already. All I really need to do is make sure that the autoitX commands in my vbprogram (which will be deployed to all machines in the future)works on all machines. thus, I need to register the AutoItX3.dll on all machines, which I've done through logon scripts.

my last hurdle is ensuring that UDFs work on all machines. This is where I am hazy.

Share this post


Link to post
Share on other sites

my last hurdle is ensuring that UDFs work on all machines. This is where I am hazy.

Just to clarify.

AutoIt3 = AutoIt3 language in a *.au3 which can be compiled into an *.exe

AutoIt3X = AutoIt3X.dll which has a subset of AutoIt3 methods that can be used within other languages i.e. VBS, JS...

You are posting in the AutoIt3 forum section and not the AutoIt3X forum section so any advice that has been given, assumed that you intended to use AutoIt3 language. Now, you state of using AutoIt3X, which has a subset of AutoIt3 functions/methods, but AutoIt3X is programmed in the language that you choose. The UDFs of AutoIt3 are made in the language of AutoIt3 so would need conversion, if possible to the language that you use (or you may not need the AutoIt3 UDF mentioned).

Share this post


Link to post
Share on other sites

thanks again MHz, that certainly cleared up my foggy understanding of autit vs autoitx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0