jgg Posted March 10, 2004 Posted March 10, 2004 I have an application which i start via a script made in autoit. The application needs a password to start, and i have made a script which send the password+enter, then access the application. Sometimes antivirus software pop-up dialog-windows and the application lost focus, the script can't log in to the application. Is there any way to get focus fo the application if ex.notepad is on top? I have tried winsetontop, controlfocus, controlenable but neither one seems to work. Only when i switch to the application the script get focus, writes the password and logs in to the application. Thanks....
Valik Posted March 10, 2004 Posted March 10, 2004 See WinActivate. Also, you may want to look into sending the text directly to controls rather than using Send to the window. See ControlSend for more information. (Sending directly to the control doesn't require the window be on top, either)
jgg Posted March 12, 2004 Author Posted March 12, 2004 I have tried with control send,doens't work. Here is the box for AutoWindowSpy: >>>>>>>>>>>>( Window Title )<<<<<<<<<<<<< Ange lösen ( classname=#32770 ) >>>>>>>>>>>( Mouse Position )<<<<<<<<<<<< On Desktop: x: 1059 y: 271 In Window: x: 892 y: -11 >>>>>>>>>>>>>( Pixel Color Under Mouse)<<<<<<<<<<<<< Dec: 14653050 Hex: 0xDF967A >>>>>>>>>>>( Window Position )<<<<<<<<<<< left: 167 top: 282 width: 221 height: 74 >>>>>>>>( Last Control Under Mouse )<<<<<<< >>>>>>>>>( Status Bar Text )<<<<<<<< >>>>>>>>>>>( Visible Window Text )<<<<<<<<< OK >>>>>>>>>>( Hidden Window Text )<<<<<<<<< How do i write the correct autoit-code? So here looks the code now: ControlSend ( "Ange lösen", "", "classname#32770", "losen{ENTER}" )
jgg Posted March 26, 2004 Author Posted March 26, 2004 No replies means this isn't possible to do with autoit, or??
Developers Jos Posted March 26, 2004 Developers Posted March 26, 2004 Did you use Winactivate("Ange lösen") before your send command ?? 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.
scriptkitty Posted March 26, 2004 Posted March 26, 2004 Move the mouse over the part you typr in and look under the section: >>>>>>>>( Last Control Under Mouse )<<<<<<< in AutoIt window spy. You can try: WinSetOnTop ( "Ange lösen", "", 1) winactivate("Ange lösen") ; send("pass{enter}") AutoIt3, the MACGYVER Pocket Knife for computers.
jpm Posted March 26, 2004 Posted March 26, 2004 (edited) Did you use Winactivate("Ange lösen") before your send command ??No need if you use ControlSend.I hope your problem does come from a missing = or you forget to set Opt("WinTitleMatchMode",4)ControlSend ( "Ange lösen", "", "classname=#32770", "losen{ENTER}" ) Edited March 26, 2004 by jpm
Valik Posted March 26, 2004 Posted March 26, 2004 That can't be the correct classname for the Control. #32770 is the class name of a dialog box.
jgg Posted March 26, 2004 Author Posted March 26, 2004 Under "Last Control Under Mouse" when i stand in the password-box i got: >>>>>>>>>>>>( Window Title )<<<<<<<<<<<<< Ange lösen ( classname=#32770 ) >>>>>>>>>>>( Mouse Position )<<<<<<<<<<<< On Desktop: x: 237 y: 356 In Window: x: 48 y: 45 >>>>>>>>>>>>>( Pixel Color Under Mouse)<<<<<<<<<<<<< Dec: 16777215 Hex: 0xFFFFFF >>>>>>>>>>>( Window Position )<<<<<<<<<<< left: 189 top: 311 width: 221 height: 74 >>>>>>>>( Last Control Under Mouse )<<<<<<< Class: Edit1 Text: >>>>>>>>>( Status Bar Text )<<<<<<<< >>>>>>>>>>>( Visible Window Text )<<<<<<<<< OK >>>>>>>>>>( Hidden Window Text )<<<<<<<<< How will i write the script to function when i found Last Control Under Mouse?
jgg Posted March 26, 2004 Author Posted March 26, 2004 It works.... ALMOST - the script writes in the password, but don't send enter. I = 1 While $I < 2 Opt("WinTitleMatchMode",4) ControlSend ( "Ange lösen", "", "Edit1", "losen{ENTER}" ) Sleep ( 6000 ) Wend Anyone seeing what's wrong?
Developers Jos Posted March 26, 2004 Developers Posted March 26, 2004 you probably have a button that can be clicked to enter the password ?? Check with AutoIt-Spy the name of that control as well and send the {ENTER} to that name.... 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.
jgg Posted March 26, 2004 Author Posted March 26, 2004 Yes, it:s >>>>>>>>( Last Control Under Mouse )<<<<<<< Class: Button1 Text: OK How does i have to write the script?
Developers Jos Posted March 26, 2004 Developers Posted March 26, 2004 try it this way: ControlSend ( "Ange lösen", "", "Edit1", "losen" ) ControlSend ( "Ange lösen", "", "Button1", "{ENTER}" ) 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.
Developers Jos Posted March 26, 2004 Developers Posted March 26, 2004 you can also try this one: ControlSend ( "Ange lösen", "", "Edit1", "losen" ) ControlClick("Ange lösen", "", "Button1") 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.
jgg Posted March 26, 2004 Author Posted March 26, 2004 Now it works. GREEAAAT, fantastic. I don't know why it didn't work at first, i compiled the script with enter at the ok-box and then it worked. Now i know that the script will log in to the application EVEN if antivirus-program with pop-ups is doing that the application lost focus. Thanks....
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