Jump to content
Sign in to follow this  
pravi1986

Issue with Regaining Window GUI access

Recommended Posts

pravi1986

Hi,

I am running an XmlRpc client/server program, in which the Client side python code triggers the Autoit script("kumar.exe") which is to perform an application installation.

Autoit script is in server side and it is triggered from client machine.

here when the autoit script gets triggered , the installation setup window loses it's control and hence the installation is not proceeding.

Can anyone help in solving this problem ??

Client side python code:

-----------------------------------------------------------------------------------------------------------------

import xmlrpclib

import sys

proxy = xmlrpclib.ServerProxy('http://'+sys.argv[1]+':8001')

#print ("AutoIT script trigger output %s" % str(proxy.ads_trigger("c:\Sharing\kumar.exe")))

get_line = proxy.ads_trigger("c:\Sharing\kumar.exe")

out_file = open(r"c:\builds\ads-log248.txt", "w")

out_file.write("%s" %(get_line))

out_file.close(

---------------------------------------------------------------------------------------------------------------

AutoIT Script code:

---------------------------

#include <Process.au3>

#Include <GuiToolBar.au3>

#include <GUIConstantsEx.au3>

ADS_Install()

Exit

Func ADS_Install()

RunAsWait("Administrator", "", "Emc@123", 0, "C:\Sharing\abcd.exe")

WinWaitActive($val, "Welcome to the Avamar Downloader")

Send("{ENTER}")

WinWaitActive($val, "Install Avamar Downloader")

Send("{ENTER}")

WinWaitActive($val, "&Install")

Send("{ENTER}")

WinWaitActive($val, "&Finish")

Send("{ENTER}")

EndFunc

Share this post


Link to post
Share on other sites
pravi1986

thanks and Yes that $val value i am reading it as a string value.

here when the autoit script gets triggered , the installation setup window loses it's control and hence the installation is not proceeding.

Any idea or any solution to this issue.?

Share this post


Link to post
Share on other sites
BrewManNH

This topic should really be in General Help & Support, but anyways, you should use ControlSend instead of Send, then it won't matter what window is the active one.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
pravi1986

I have tried ControlSend instead of Send and still it's not solving the problem.

Any other solution for the issue.

Share this post


Link to post
Share on other sites
pravi1986

AutoIT complete code:

---------------------------

#include <Process.au3>

#Include <GuiToolBar.au3>

#include <GUIConstantsEx.au3>

Local $install = "C:SharingDownloaderService-7.0.0-1.exe"

ADS_Install()

Exit

Func ADS_Install()

Run($install)

WinWaitActive("Downloader Service 7.0.0.1 setup", "Welcome to the Downloader service")

Send("!n")

WinWaitActive("Downloader Service 7.0.0.1 setup", "Install Downloader service")

Send("!n")

WinWaitActive("Downloader Service 7.0.0.1 setup", "&Install")

Send("{ENTER}")

WinWaitActive("Downloader Service 7.0.0.1 setup", "&Finish")

Send("{ENTER}")

EndFunc

Share this post


Link to post
Share on other sites
BrewManNH

Where do you have an issue with this in the code above, where is it not sending the correct information to the correct screen. Also, what is taking focus away from this installer when you run it?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
pravi1986

Hi,

When the installation is trigger from the client side, the installation window lost it's control and hence the installation is not proceeding.

Please help me out in resolving the issue.

Please find the attached screenshot of the issue state.

Below the complete code information

Python version used : 2.7.3

Host Machine IP : 10.110.112.121

Run the server code first and then start the client side code.

In server machine : - server side code, autoitscript.exe, application to be installed(.exe file)

In Client machine : - client side code

Autoit code:

#include <Process.au3>

#Include <GuiToolBar.au3>

#include <GUIConstantsEx.au3>

Firefox_Install()

Exit

Func Firefox_Install()

Run("C:\Sharing\Firefox Setup 18.0.2.exe")

WinWaitActive("Mozilla Firefox Setup", "Welcome to the Mozilla Firefox Setup Wizard")

Send("{ENTER}")

WinWaitActive("Mozilla Firefox Setup", "Setup Type")

Send("{ENTER}")

WinWaitActive("Mozilla Firefox Setup", "Summary")

Send("{ENTER}")

EndFunc

Server Side Code (rpc_server.py)

------------------------------------------

import xmlrpclib

import os,sys,re

from SimpleXMLRPCServer import SimpleXMLRPCServer

global cmd_out

def ads_trigger(n):

cmd_out = os.popen("%s" %(n))

server = SimpleXMLRPCServer(("10.110.112.121", 8001))

print ("Listening on port 8001...")

server.register_function(ads_trigger, "ads_trigger")

server.serve_forever()

-----------------------------------------

Machine IP : 10.110.112.121

Client Side Code (rpc_client.py)

----------------------------------------

import xmlrpclib

import sys

proxy = xmlrpclib.ServerProxy('http://'+sys.argv[1]+':8001')

proxy.ads_trigger("c:\Sharing\autoitscript.exe")

----------------------------------------

In the command prompt, type “python rpc_client.py 10.110.112.121

post-79069-0-83073200-1364310225_thumb.j

Share this post


Link to post
Share on other sites
pravi1986

Can anyone help me out on this issue.. i am struggling on this for quite some time.

Thanks in advance.

Share this post


Link to post
Share on other sites
BrewManNH

Do you need Python to be able to launch the script?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
pravi1986

Yes, we need Python installed in order to run python script which in turn trigger's Autoit script.

Share this post


Link to post
Share on other sites
BrewManNH

What I meant was, do you need python to launch the script, or could you launch the script another way?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
pravi1986

Yes, i am using python to trigger autoit script.

Share this post


Link to post
Share on other sites
LarryDalooza

A fundamental in interacting with windows... is...

WinWait() for the window... If Not WinActive Then WinActivate() the window... WinWaitActive() the window.

However, I am sure there are command line parameters to pass to make it install automatic without interaction.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
pravi1986

Can you please share those info of how to perform installation command line.

Share this post


Link to post
Share on other sites
LarryDalooza

I can't believe, after 13 years, I am still googling for people... Try the -ms switch...

"Firefox Setup 18.0.2.exe" -ms

... get your quotes right or I am going to lobby for your banishment

Lar


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
pravi1986

Still it's not working. Any other option ??

Share this post


Link to post
Share on other sites
pravi1986

can anyone help in resolving this issue. struggling for quite some time.

Share this post


Link to post
Share on other sites
BrewManNH

Yes, i am using python to trigger autoit script.

Not what I asked, what I asked was do you NEED to use Python to run the script or can you launch the exe another way?

Still it's not working. Any other option ?

Yes, the option is you tell us what doesn't work instead of a blanket not working post, that's not at all helpful to us or you. Once you figure out how to properly explain your problem and what you've done and what exactly isn't working and exactly how it's not working, then you should come back with a more sensible post. Otherwise you're on your own as far as I'm concerned.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.