Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ruby Programming Language

Issue with ControlSend function using AutoIT in Ruby


I'm having an issue running scripts that use AutoIT against my windows
box, half the time the ControlSend function sends a string to the GUI
that should be all upcase, in a hodge-podge of different case letters.

Example:

I'm trying to send a string to a window with the following variables,
ext.
(this isn't the actual code, just the pertinent bits)

@datestring = date.year.to_s + "_" + date.month.to_s + "_" +
date.day.to_s
@hostname = `hostname`
@hostname = @hostname.upcase.to_s.chomp

autoit = WIN32OLE.new("AutoItX3.Control")
autoit.ControlSend("Enter SQL Database Information", "", 302,
"LMNIGHTLY#{@hostname}#{@datestring}")

Most of the time this will send a string like
"LMNIGHTLYHOSTNAME2007_5_25" but occasionally it sends a string like
"lMNIgHTlyHOsTNAME2007_5_2".

At other places in the script it has the send the same string to a
system call, and this always comes out correctly, so it seems like it's
just a problem with AutoIT.

Also the issue seems specific to some aspect of my windows configuration
because the script runs fine on some servers and not on others.

Has anyone had experience with this issue before?

--
Posted via http://www.ruby-forum.com/.

On May 25, 1:51 pm, Skye Weir-Mathews <carpeur@gmail.com> wrote:
...SNIP...
> Most of the time this will send a string like
> "LMNIGHTLYHOSTNAME2007_5_25" but occasionally it sends a string like
> "lMNIgHTlyHOsTNAME2007_5_2".

> At other places in the script it has the send the same string to a
> system call, and this always comes out correctly, so it seems like it's
> just a problem with AutoIT.

...SNIP...

The AutoItX docs indicate the the Send command is sensitive to the
state of Caps Lock
and also can be affected is a user happens to be holding down SHIFT
when the command
is executed. Would explain the intermittent/seemingly system dependent
behavior...

Cheers
Chris Hulan

ChrisH wrote:
> The AutoItX docs indicate the the Send command is sensitive to the
> state of Caps Lock
> and also can be affected is a user happens to be holding down SHIFT
> when the command
> is executed. Would explain the intermittent/seemingly system dependent
> behavior...

> Cheers
> Chris Hulan

This worked well at first, but then my issue came back which is
confusing to me, because I've run a number of tests making absolutely
sure that Caps Lock is turned off and I wasn't touching the keyboard at
all. Interestingly enough when AutoIT send a bad string, it always
downcases the same letters (when "LMNIGHTLYHOSTNAME2007_5_25" is bad, it
always looks like "lMNIgHTlyHOsTNAME2007_5_2") which makes me think that
it's not related to input from the keyboard, which is likely to be
different every time.

--
Posted via http://www.ruby-forum.com/.

On 5/29/07, Skye Weir-Mathews <carpeur@gmail.com> wrote:

This seems to be an issue with autoit itself. At first I intended to
ask you to try with standalone autoit, but then I googled a bit, and
found [1]. So look at autoit site if there's a solution. I'm too
sleepy to do anything more now.

Jano

[1] http://www.autoitscript.com/forum/index.php?showtopic=15499

Okay, I think I figured it out, my script was automating an installer
and sending messages to STDOUT letting me know how it was progressing
through the installation

for example:

puts "Enter Microsoft SQL Database Authentication Information"

autoit.WinWait("Enter Microsoft SQL Database Authentication
Information", "", 5)

autoit.ControlSend("Enter Microsoft SQL Database Authentication
Information", "", 301, "XXX")

autoit.ControlSend("Enter Microsoft SQL Database Authentication
Information", "", 302, "XXX")

autoit.ControlSend("Enter Microsoft SQL Database Authentication
Information", "", 1, "{ENTER}")

so, I noticed that when the script was running in the background it
installed fine, and when it was running in the foreground I got the
funky chars. Since then I commented out the lines like puts "Enter
Microsoft SQL Database Authentication Information" and it seems to be
running fine.

Thanks ya'll

--
Posted via http://www.ruby-forum.com/.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc