Sign in to follow this  
Followers 0
henrylee

Getting window to appear

15 posts in this topic

Hello,

I am currently using AutoItX3 through Ruby and am having some issues.

I am trying to write a script that opens up an application, enters in login credentials, and attempts to log in.

The problem I am running into is that the actual window for the application I want to run never pops up. When I use the Run function, I get a PID and I can see that the correct process is running, but I do not get the window to pop up. 

Any ideas?

Thank you

Share this post


Link to post
Share on other sites

How about posting your code so we can see just what you're trying to do?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Sorry, here's the code (with the details hidden):
 
require 'win32ole'
 
def set_up
   @au3 = WIN32OLE.new ("AutoItX3.Control")
   @au3.opt "WinTextMatchMode", 2
end
 
def open
   pid = @au3.Run('PATH', "", @SW_SHOWMAXIMIZED)
   return pid
end
 
def enter
   @au3.Send "{ENTER}"
end
 
def tab
   send "{TAB}"
end
 
def send s
   warn s
   @au3.Send s.to_s
end
 
set_up
username = "***"
password = "***"
 
pid = open
@au3.WinWaitActive("AppTitle")
send username
tab
send password
enter
@au3.ProcessClose(pid)

Share this post


Link to post
Share on other sites

Since the keyboard input is going to active window, it never gets sent to the application because the window does not appear. 

Does anyone know how to remedy this?

Share this post


Link to post
Share on other sites

The program you are running AND the way you are running the Ruby script are pretty important.

If the Ruby script is running as a system user like a service, you won't see the window.

Share this post


Link to post
Share on other sites

I've been running the script as Admin through the Command Prompt.

Share this post


Link to post
Share on other sites

Have you checked the task manager to be sure that the program you are running is actually running?

Share this post


Link to post
Share on other sites

Yes, I see the program running as a process in the Task Manager.

When I pass the exact path into the command line, the program window comes up. Also, when I don't use Ruby and just put the run function into a .au3 file, it opens fine as well.

Share this post


Link to post
Share on other sites

Oh I think I just realized what you've done wrong. I don't know Ruby so this might not be it though.

The window state SW_MAXIMIZED is a property on the AutoItX object, and not a stand alone variable. I think you may be sending a zero instead which might be a hidden window.

Share this post


Link to post
Share on other sites

I also tried taking out all of the other options so that it was just:

@au3.Run('PATH')

But that did not do anything differently.

Share this post


Link to post
Share on other sites

I'm not sure then. Why can't you tell us what you're running anyway?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

It's a program for my job. Not that its necessarily top secret, just thought there wasn't a need to put the name out there.

Edited by henrylee

Share this post


Link to post
Share on other sites

Just to be sure, which version of AutoItX are you using?

Share this post


Link to post
Share on other sites

Ok so it's not an old version issue.

Right after you open it, check the error property on the AutoItX object. See if it is true.

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