Jump to content

Recommended Posts

Hi all very new to AutoIT so I wrote up a small script to open a program, enter a password, submit and close the program. The script works 100% when I execute it on the local pc. I am unable to get it to run when attempting it remotely. I use psexec and the .exe can be seen in the task manager on the target machine but it just stays there forever. Any Ideas as to whats going on?

 

Here is the .au3 script 

; Script Start -

 

ShellExecute("D:\One\onemore\config\blah\blah.exe")

AutoItSetOption('MouseCoordMode', 0)

WinWait(Program – Some Program')

WinActivate(Program – Some Program')

MouseClick('primary', 153, 195, 1, 0)

Send('password')

MouseClick('primary', 294, 196, 1, 0)

WinWait(Program – Some Program)

MouseClick('primary', 634, 13, 1, 0)

Link to post
Share on other sites

Probably the winwait is waiting forever.  Put a timeout to see if this is the case, and an error handling after to ensure you got it right.

Link to post
Share on other sites
1 minute ago, Nine said:

Probably the winwait is waiting forever.  Put a timeout to see if this is the case, and an error handling after to ensure you got it right.

Ill give that a whirl, how would I do the error handling?

Link to post
Share on other sites
Posted (edited)

Ok I updated the script with timeouts and it works locally. When I attempt to run via ansible using the win_psexec module(interactively or not) I get a false positive. I know its not working because when you submit the last click its supposed to  make a log entry to show a successful login. Any ideas?

 

Updated au3

ShellExecute("D:\One\Onemore \config\blah\blah.exe")
AutoItSetOption('MouseCoordMode', 0)
WinWait("[CLASS:someprogram]", "", 5)
WinActivate(someprogram)
MouseClick('primary', 153, 195, 1, 0)
Send('password')
MouseClick('primary', 294, 196, 1, 0)
WinWait("[CLASS:someprogram]", "", 5)
MouseClick('primary', 634, 13, 1, 0)

 

Edited by Jos
added codebox
Link to post
Share on other sites

I don't know if you have already done this, but do you use the -i parameter in the psexec command which starts your executable?

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to post
Share on other sites

Yes here is my playbook for ansible, return code 0 and it says it’s a success but a false positive due to there begin no long entry on the program. 

---

- hosts: all

  gather_facts: yes

 

  tasks:

    - name: Execute ODT HeartbeatTest

      win_psexec:

        command: D:\Blah.exe \i

        elevated: yes

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...