Sign in to follow this  
Followers 0
szucsaaron

ControlClick with PixelSearch

20 posts in this topic

#1 ·  Posted (edited)

Hey!
I would like to write a script which clicks to a bookmark of mine while it's on the tray. 

Global $Paused
HotKeySet("{F2}", "TogglePause")
HotKeySet("{F3}", "Terminate")
HotKeySet("{F1}", "Start")

$GoogleChrome = 0x9E0E09 ; Youtube icon color

MsgBox(4096, "", "Go to DeskTop Before Pressing Home.")

While 1
    Sleep(10)
WEnd


Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused".To resume press "Pause" again', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    MsgBox(4096, "", "Press ok To close IE opener.")
    Exit 0
EndFunc   ;==>Terminate

Func Start()
    If $t = PixelSearch(@DesktopWidth, @DesktopHeight, 34, 80, $GoogleChrome) Then
        ControlClick("Facebook - Google Chrome", "", 101973760, "Left", "1",)
    Else
        MsgBox(64, "Error", "Not found")
    EndIf
EndFunc   ;==>Start

I would like to write this script in order to speed up opening a specified page (like youtube) even if i have lagg.

+I started writing this script because i have read the help file under PixelSearch and these were it's parameters:

left left coordinate of rectangle.

top top coordinate of rectangle.

right right coordinate of rectangle.

bottom bottom coordinate of rectangle.

color Colour value of pixel to find (in decimal or hex).

shade-variation [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match).

step [optional] Instead of searching each pixel use a value larger than 1 to skip pixels (for speed). E.g. A value of 2 will only check every other pixel. Default is 1.

hwnd [optional] Window handle to be used.

The last one means that you can use this function for Windows which are not on the screen but maybe on the tray.

Thanks for help!

Edited by szucsaaron

Share this post


Link to post
Share on other sites



Why don't you directly access the objects you need to click on?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#JohnOne But than why hwnd command is there as well?
I mean it means :D that you it handels a specific window.

#water How do i do that?

Share this post


Link to post
Share on other sites

Can you please elaborate on what you mean by "clicks to a bookmark of mine while it's on the tray."

Is this a link on the desktop, a bookmark in a browser ...?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Bookmark in browser.
And btw i would like to do it in a way that when for exmaple I start playing with a game, i click on the script which will in the webbrowser click on the icon (in bookmarks) of build/guides page so it runs meanwhile a start the game.

+"clicks to a bookmark of mine while it's on the tray it" means that it operates while the browser is on the tray.Like the example script for ControlSend, but with click.

Share this post


Link to post
Share on other sites

Which browser do we talk about: Internet Explorer, Firefox ...?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Google Chorme.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Or, btw it could be any of the ones mentiond by you, if it does the controlClick.

Because then you only need to change some pixels.

Edited by szucsaaron

Share this post


Link to post
Share on other sites

Google Chorme.

I don't think there is a Chrome UDF title="">available.

If it were IE or FF then AutoIt could use the available UDFs.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Sorry, my bad. Should be: ControlGetText


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Oh. Isn't it possible to do with control send and Pixelsearch?

Share this post


Link to post
Share on other sites

Not while on the tray as JohnOne stated in his post.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

What if it wasn't on  the tray but it would not be active. By this i mean that the window is not on top but still on the screen?

Share this post


Link to post
Share on other sites

A Bookmark just contains an URL. Why don't you start the browser with AutoIt and pass the URL?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

:D 
That would be too easy :D

And i could also do that by making a shortcut for that URL.

Share this post


Link to post
Share on other sites

That's it. If you have a knife that solves your problem in 2 seconds, why use a spoon and try for days?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

True. :D
Thanks for your help and patience. :)

Best regards,

szucsaaron

Share this post


Link to post
Share on other sites

Sometimes a solution you have in mind is way too complex.

But it looks like you can achieve the same goal with just a few lines of code.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I totaly agree with that. :)

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  
Followers 0