henrylee Posted February 17, 2014 Share Posted February 17, 2014 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 17, 2014 Moderators Share Posted February 17, 2014 How about posting your code so we can see just what you're trying to do? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
henrylee Posted February 17, 2014 Author Share Posted February 17, 2014 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) Link to comment Share on other sites More sharing options...
henrylee Posted February 18, 2014 Author Share Posted February 18, 2014 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? Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 19, 2014 Share Posted February 19, 2014 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. Link to comment Share on other sites More sharing options...
henrylee Posted February 19, 2014 Author Share Posted February 19, 2014 I've been running the script as Admin through the Command Prompt. Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 20, 2014 Share Posted February 20, 2014 Have you checked the task manager to be sure that the program you are running is actually running? Link to comment Share on other sites More sharing options...
henrylee Posted February 20, 2014 Author Share Posted February 20, 2014 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. Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 20, 2014 Share Posted February 20, 2014 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. Link to comment Share on other sites More sharing options...
henrylee Posted February 20, 2014 Author Share Posted February 20, 2014 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. Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 22, 2014 Share Posted February 22, 2014 I'm not sure then. Why can't you tell us what you're running anyway? Link to comment Share on other sites More sharing options...
henrylee Posted February 26, 2014 Author Share Posted February 26, 2014 (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 February 26, 2014 by henrylee Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 27, 2014 Share Posted February 27, 2014 Just to be sure, which version of AutoItX are you using? Link to comment Share on other sites More sharing options...
henrylee Posted February 27, 2014 Author Share Posted February 27, 2014 v3.3.10.2 Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 28, 2014 Share Posted February 28, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now