Jump to content

winkill, send, winclose, controlclick etc. are not working


Recommended Posts

winkill, send, winclose, controlclick etc. are not working for my windows 7 system. I am making one old xp application (that is for checking the presence of some software in the machine) compatible with windows 7. In xp, all this function was working. But in windows 7 cert machine non of this is working. But i am sure this is not a problem with windows 7. Because all the above function is working for some application like notepad.

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Can you please show your code so we are able to see what goes wrong?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

thankyou MVP for you time.

$path = "c:programfiles(x86)myfolderDPPrintDPPrint.exe"
$hwnd = ShellExecute($path,"",StringLeft($path,StringInString($path,"",0,-1)),"",@SW_SHOWNORMAL)
$hwnd = WinActivate("DPMail Alert");title is DPMail Alert
if WinExists("DPMail Alert") Then
sleep(500)
ControlClick("DPMail Alert","","[class:Button; Instance:1]")
MouseClick("left");if control click doesnot work
sleep(500)
endif

 

I've tried all the thing to make this window close. winkill, winclose, send(!{f4}) are not working. class of the exit button is button and instance is 1. even i tried with [id:6] as well
Please help me. I am just new to it and my company needs this urgently.
Please ignore the typo, because am not copieng the code.i typed that here.

Link to comment
Share on other sites

Have you tried running it with #RequireAdmin?

Jos

thakyou jos,

I dont have admin permission in the system. But one thing i would like to point out is i am able to run, close, click exit button manually even if i am not admin. So my script should also run like that, right? Thats why i thought this will not help me.

Link to comment
Share on other sites

  • Developers

thakyou jos,

I dont have admin permission in the system. But one thing i would like to point out is i am able to run, close, click exit button manually even if i am not admin. So my script should also run like that, right? Thats why i thought this will not help me.

When you have UAC enabled and the program you want to control gave an UAC prompt, will have to add that statement to the script for it to be able to control it.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I would change the script so it waits until the window exists and then click on the button:

$path = "c:\programfiles(x86)\myfolder\DPPrint\DPPrint.exe"
ShellExecute($path,"",StringLeft($path,StringInString($path,"\",0,-1)),"",@SW_SHOWNORMAL)
$hwnd = WinWait("DPMail Alert") ; Wait until the Window exists
WinActivate($hwnd) ; Activate the window
sleep(500)
ControlClick($hwnd,"","[class:Button; Instance:1]")
sleep(500)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

When you have UAC enabled and the program you want to control gave an UAC prompt, will have to add that statement to the script for it to be able to control it.

Jos

Exactly,

I can open that application with out any hindrance of UAC. i am not at all getting any UAC prompt. both manually and through script.

Morass thing is am able to do all this functionality for notepad kinda applications (like calculatr). any idea?

Link to comment
Share on other sites

MVP,

even that not working. earlier i've placed a msgbox for simulating this situation so that control will flow to "controlclick" only after my msgbox get closed.

FYI.. this DPMail alert is an alert box that comes before the original main window comes. does it make any difference.

Link to comment
Share on other sites

  • Developers

Exactly,

I can open that application with out any hindrance of UAC. i am not at all getting any UAC prompt. both manually and through script.

Morass thing is am able to do all this functionality for notepad kinda applications (like calculatr). any idea?

So add this to the top of your script and try again:

#RequireAdmin

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

jos 

i dont have admin access. when i put that code, it is asking for admin password. I am stuck.

 

What does au3info tell you when you hover over the window you are trying to control?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Not sure if you are still trying but here s something else you can try:

It would seem you are dealing with a popup of sorts since you are starting DPPrint.exe

and the window you are trying to close is DPmail Alert.

Almost all windows buttons have a keyboard shortcut that you can use to close or continue if your mouse is broke.

I suggest you try this option for sanitys sake until you can find out what the actual name of the window (AU3INFO) is and control click as Jos suggested.

When the window has focus press the alt button and look if any of the letters become underlined, if yes then that is your keyboard shortcut.

An alternate version if the above doesnt work is to TAB to the button and send ENTER

Edited by l3ill
Link to comment
Share on other sites

Not sure if you are still trying but here s something else you can try:

It would seem you are dealing with a popup of sorts since you are starting DPPrint.exe

and the window you are trying to close is DPmail Alert.

Almost all windows buttons have a keyboard shortcut that you can use to close or continue if your mouse is broke.

I suggest you try this option for sanitys sake until you can find out what the actual name of the window (AU3INFO) is and control click as Jos suggested.

When the window has focus press the alt button and look if any of the letters become underlined, if yes then that is your keyboard shortcut.

An alternate version if the above doesnt work is to TAB to the button and send ENTER

 

What does au3info tell you when you hover over the window you are trying to control?

@jos

au3info is giving all the information well without fail. because of that i think, there could be some permission issues like read and write permission for ordinary files. i am able to read all the values using au3info but i am not able to send some thing do something on that controls.

@dabbler

even this not working.

alt on the window is not giving any proper information. its just making dashed square around ok button.

Link to comment
Share on other sites

Can any one confirm this is because of permission issue. Because am able to send all key strokes do anything in other system. or in the same system for preinstalled applications like notepad. So i am suspecting permission is the issue.

Thanks for all the techies who found time for me.

Link to comment
Share on other sites

Can any one confirm this is because of permission issue. Because am able to send all key strokes do anything in other system. or in the same system for preinstalled applications like notepad. So i am suspecting permission is the issue.

Thanks for all the techies who found time for me.

 

I doubt that. If you can manipulate notepad with a script then this should pose no additional hurdles.

Some GUI's just like to play 'hard to get'  :P

Link to comment
Share on other sites

I doubt that. If you can manipulate notepad with a script then this should pose no additional hurdles.

Some GUI's just like to play 'hard to get'  :P

I've tried to send ENTER. not working!!  :sweating:

The same GUI is  taking all the inputs from my script in other system.

ie. my script is working fine as expected in one system.

and in one system it is not working only for some typical applications.(this is the same system, this functionality is working for notepad) o:)  :

Link to comment
Share on other sites

Then I would guess that there is some difference or interference on this system; keyboard layout, or some crap running in the background causing trouble (just for instance)

The only advice I have for you is Trial and error; find something that works (by hand) and then script that. Then tweak it until it works.

I feel your pain :-)  I have some progs here that do not allow au3info and dont have any keyboard shortcuts that still needed automation.

So basically it depends on how important it is and how much time you want to spend on it....

Good luck!

Bill

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...