Sign in to follow this  
Followers 0
anom1234

Mouse Click on Text in a Window

12 posts in this topic

#1 ·  Posted (edited)

Hello!

Let me start off by saying that I've used both the search function of this site and the help file within the program. Both were very useful, so thanks!

What I'm trying to accomplish:

Have the mouse click on the word "NOW" on a webpage, every 15-16 minutes or so. The word is all capitalized, and is a different color than most of the other words on the page.

Every now and then the word changes from "NOW" to random other words, so when it see's those other words, I'll need to have it stop the script and display a msgBox.

Currently I have successfully set up a program that:

1. Waits 5 seconds after execution before doing anything (Gives me time to put the mouse manually over the word "NOW"

2. Left clicks the mouse button once

3. Waits between 15 and 16.5 minutes (Randomly) and then clicks again.

For additional features I've added a "Time Left" and a "Time Total" to the task menu tray.

A few minor issues:

The "time total" I've gotten to display in seconds by dividing it by 60,000, but the same trick does not work for the "TimeLeft" function.

Notes:

It needs to work on different resolutions monitors

Thanks again for any help you can offer.

What I've currently got below:

#include <Constants.au3>
#Include <Timers.au3>
#NoTrayIcon

$i = 0
$RandomTimer = 915000
Sleep (5000); Wait 5 Seconds before the first click.
$iTimerProgress = _Timer_SetTimer($RandomTimer); create timer

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown.

TraySetClick(16); Only secondary mouse button will show the tray menu.

$infoitem = TrayCreateItem("Time Gone By")
TrayItemSetOnEvent(-1,"TimeLeft")

$infoitem = TrayCreateItem("Total Time Waiting")
TrayItemSetOnEvent(-1,"TimeTotal")

TrayCreateItem("");line in the tray between exit and time left options

$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")

TraySetState()

Do
    MouseClick ( "left" )
    $i = $i + 1;increase $i
    $begin = TimerInit()
    $RandomTimer = Random(915000, 990000, 1)
    $iTimerProgress = ($RandomTimer/60000);This is needed to make a number show up when right clicking.  Also converts it to minutes!
    Sleep($RandomTimer); Wait between 15.25 and 16.5 minutes before clicking.
Until $i = 100


Exit


; Functions
Func TimeLeft()
    $dif = TimerDiff($begin)
    MsgBox(0,"Time Gone By",$dif)
EndFunc

Func TimeTotal()
    Msgbox(0,"Total Time Waiting", $iTimerProgress+" ", 3) 
EndFunc

Func ExitScript()
    Exit
EndFunc
Edited by anom1234

Share this post


Link to post
Share on other sites



Saw I was on page 2 with no response.

SHAMELESS BUMP!

:P

Share this post


Link to post
Share on other sites

Shameless bump # 2 :P

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Please keep bumping. You'll be banned for forum abuse. :P

Obviously he put some effort, look at the Original Post. Maybe you should tell him not to bump before 24 hours of the last post of his thread. Maybe you should be nicer :( Edited by SwiftBurns

Share this post


Link to post
Share on other sites

Obviously he put some effort, look at the Original Post. Maybe you should tell him not to bump before 24 hours of the last post of his thread. Maybe you should be nicer :P

Thanks, I'll make sure to wait 24 hours from this post.

Share this post


Link to post
Share on other sites

Thanks, I'll make sure to wait 24 hours from this post.

bump

Share this post


Link to post
Share on other sites

you might be able to try to use WinWaitActive or WinExists with the word NOW something like if the word NOW is there then it clicks that spot and if its not then keep going

WinWaitActive("Title of Webpage - Browser", "NOW", 1000)

or If WinExists("Title of Webpage - Browser", "NOW") Then

MouseClick("left", xcoord,ycoord,1,10)

EndIf

Share this post


Link to post
Share on other sites

you might be able to try to use WinWaitActive or WinExists with the word NOW something like if the word NOW is there then it clicks that spot and if its not then keep going

WinWaitActive("Title of Webpage - Browser", "NOW", 1000)

or If WinExists("Title of Webpage - Browser", "NOW") Then

MouseClick("left", xcoord,ycoord,1,10)

EndIf

As I understand it, that would only work in the case of "NOW" being in the title correct? Thanks for the suggestion, but the word now is unfortunately not in the title :P . Really do appreciate your thoughts though!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

i have done this before for an auto login script that i made here

find the number of tabs you require to get to the text input control from when you open a new tab and do it like that i made this code.

#include <GuiConstantsEx.au3>

;hotkey
HotKeySet("^kl", "_NET_LOGIN")

func _NET_LOGIN()
    msgbox(0, "Loading...", "Loading Your Favy Sites!!!")
    ShellExecute("firefox.exe")
    WinWaitActive("Google - Mozilla Firefox")
    send("^l")
    send("^t")
    Send("http://www.acidmods.com/forum/index.php?PHPSESSID=79dc6ebd6c91ce53cefc2b731dde8fb5&board=2.0")
    send("{ENTER}")
    sleep(100)
    send("^t")
    Send("http://forums.qj.net/forumdisplay.php?f=11")
    send("{ENTER}")
EndFunc

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
wend
Edited by FaT3oYCG

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites

i have done this before for an auto login script that i made here

find the number of tabs you require to get to the text input control from when you open a new tab and do it like that i made this code.

#include <GuiConstantsEx.au3>

;hotkey
HotKeySet("^kl", "_NET_LOGIN")

func _NET_LOGIN()
    msgbox(0, "Loading...", "Loading Your Favy Sites!!!")
    ShellExecute("firefox.exe")
    WinWaitActive("Google - Mozilla Firefox")
    send("^l")
    send("^t")
    Send("http://www.acidmods.com/forum/index.php?PHPSESSID=79dc6ebd6c91ce53cefc2b731dde8fb5&board=2.0")
    send("{ENTER}")
    sleep(100)
    send("^t")
    Send("http://forums.qj.net/forumdisplay.php?f=11")
    send("{ENTER}")
EndFunc

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
wend
What a great idea! I'll give that a try and let you know!

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