Ikillu762

Activate Window

25 posts in this topic

#1 ·  Posted

I can't get WinActivate() to work

I am trying to get it to activate a google chrome window

Share this post


Link to post
Share on other sites



#2 ·  Posted

Code please?

Share this post


Link to post
Share on other sites

#3 ·  Posted

You know what, never mind.  I don't need or want to see it:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
$win = WinWait ( "[CLASS:Chrome_WidgetWin_1]" )
WinActivate ( $win )
WinWaitActive ( $win )

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Ok. I wasn't sure how the WinWait and WinActivate worked

 

All I had was this:

Example()
Func Example()
    WinActivate(Chrome)
EndFunc
 
Thanks. Do you have a code snippet that explains/shows how to simulate a mouse Click the (left button) at a set of cords?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Well that depends.  Are the cordinates relative to the Active Window or the whole screen?  Also, have you discovered the AutoIt Window Info tool?

Edited by MattHiggs

Share this post


Link to post
Share on other sites

#6 ·  Posted

The whole screen

Share this post


Link to post
Share on other sites

#7 ·  Posted

I assume it is sort of possible to be both, but it is better I try for the whole screen

Share this post


Link to post
Share on other sites

#8 ·  Posted

Well it defaults to the whole screen, so there is that.  Have you discovered the AutoIT window info tool:

fqq5VlG.png

Share this post


Link to post
Share on other sites

#9 ·  Posted

I have not. Is it included with the install?

Share this post


Link to post
Share on other sites

#10 ·  Posted

All you have to do is, using this tool, drag and drop the crosshairs onto the spot where you want the mouse to click, then go to the below tab:

yMTIqE2.png

Share this post


Link to post
Share on other sites

#11 ·  Posted

Then, use the below function, which will perform a left click at the coordinates you obtained from the Window info tool.  The below code uses the values seen in the picture of previous post.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
MouseClick ( "left", 841, 202 )

 

Share this post


Link to post
Share on other sites

#12 ·  Posted

Nevermind. I'm such a noob. I just found it. Thank you!

Share this post


Link to post
Share on other sites

#13 ·  Posted

Obviously my next problem is going to be how to figure out a way to script an image-on screen- check/validate+locate

Share this post


Link to post
Share on other sites

#14 ·  Posted

Also, a word to the wise.  I don't know what it is you are trying to get your script to do, but be aware that, if the application/window which you are trying to have your script interact with is elevated (run with admin credentials), the script will also need to be compiled to run with admin permissions.

Share this post


Link to post
Share on other sites

#15 ·  Posted

1 minute ago, Ikillu762 said:

Obviously my next problem is going to be how to figure out a way to script an image-on screen- check/validate+locate

Well not obvious to me.  I am not sure what it is you are trying to do.  If you shared some details, I might be able to help.

Share this post


Link to post
Share on other sites

#16 ·  Posted

Ok. I did see somewhere that that was a possibility. I am simply trying to automate some browser (tasks) capabilities

Share this post


Link to post
Share on other sites

#17 ·  Posted

Since I have no way of reading packets that I can't seem to find, I am trying to include an image check to ensure that a portion of the web-page is where it should be

Share this post


Link to post
Share on other sites

#18 ·  Posted

In that case, I would advise against doing it in chrome.  Autoit has functions built into it which provide ways to automate internet explorer in very advanced ways, and I would recommend using those for web-based automation

Share this post


Link to post
Share on other sites

#19 ·  Posted

1 minute ago, Ikillu762 said:

Since I have no way of reading packets that I can't seem to find, I am trying to include an image check to ensure that a portion of the web-page is where it should be

Yeah, you are going about this the wrong way then.  You need to be using the Internet explorer functions to write the script, as web browsers don't function the same as native applications.

Share this post


Link to post
Share on other sites

#20 ·  Posted

Again.  specifics.  If you tell me what you are trying to do, I might be able to help more.

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