Jump to content
Macro Express Forums

Mouse clicks not working for website log in


Recommended Posts

I have a simple script for logging into a site so I don't have to type every time. It opens the site and detects the mouse move just fine, but It doesn't  detect the mouse clicks. So the email and password can't be entered. My screen cap doesn't show it but the cursor ends up sitting on the log in button as intended. But that's where it stops. It seems simple but stuck here. I have a laptop with a wireless Logitech mouse, and I've also tried the touch pad with not luck.

Thx!

image.png.e5d8014eaff810fc186a17e2e5e842e5.png

image.thumb.png.30ffd1ab7253b510569d5fc1c00685db.png

Link to comment
Share on other sites

So I realized I can just go straight to the log in page:

"https://todoist.com/users/showlogin"

Then the user name field is sometimes highlighted and the script enters the user name/pass no problem. But sometimes the field is not highlighted and the script fails.

Any ideas?

 

Link to comment
Share on other sites

If I'm understanding correctly, when the login page loads, sometimes the user name field has focus, and sometimes it doesn't? When there is no macro in the picture, is this behaviour normal for the page?

 

Adding a two or three second delay after loading the web page might help.

Link to comment
Share on other sites

27 minutes ago, acantor said:

Adding a two or three second delay after loading the web page might help.

The web page may not yet be completely loaded when the macro clicks the mouse and types.  As an experiment, remove the Website command from the macro; load the website manually; then run the macro.  If it then does what you want, then it's a timing issue, so add the delay like acantor says, or try the "wait for website" command.

Link to comment
Share on other sites

8 minutes ago, Scotsman said:

How do I make sure the web browser is focused?

 

That's a big question. There are a lot of focus issues with Windows 10.

 

This might work:

 

Window Activate: Window Title Goes Here!

 

Or maybe something like this. (You'll need to figure out the x,y coordinates):

 

Mouse Move: 100, 200 Relative to Current Window
Mouse Left Click

 

 

Link to comment
Share on other sites

1 hour ago, Scotsman said:

How do I make sure the web browser is focused?

If it's hit-or-miss on timing, one way is to find a specific spot on the screen with a predictable color when the web page is completely loaded.  For example, this routine repeats for about 12 seconds, looking for the combination of white in one location, and blue for the login button, which occurs once the web page has finished loading. 

  Repeat Start (Repeat 12 times)
    Mouse Move: 900, 500 Relative to Screen
    Mouse Left Click // Click white area to bring page into focus
    Delay: 500 milliseconds, without ability to halt
    Mouse Move: 770, 560 Relative to Screen // Hover over button area until expected dark blue color is found
    Delay: 500 milliseconds, without ability to halt
    Get Pixel Color from Beneath the Mouse into %N[1]%
    Get Pixel Color at (840, 540) Relative to Screen into %N[2]%
    If Variable %N[1]% Equals "6567680" // Blue
      AND
    If Variable %N[2]% Equals "16777215" // White
      Repeat Exit
    Else
    End If
  End Repeat
  // Type name and password, tab to Submit button and ENTER

 

Link to comment
Share on other sites

It's challenging (verging on impossible!) to write a macro that is 100% reliable, especially when a macro interacts with web content. If adding a longish delay allows the macro to work nine times out of ten, you're doing good. Increasing the length of the delay may improve reliability, or make no difference.

 

Adding extra code to ensure a target window has focus -- as Cory mentions and rberq illustrates with his pixel monitoring routine -- helps a macro run more quickly and more reliably. But you need to be a bit of a "macro geek" to go to this extra trouble!

 

The need to geek-out to improve script reliability is part-and-parcel of using third-party scripting tools. AutoHotkey, for example, is more powerful than Macro Express. Yet many of my AutoHotkey scripts had to be gussied up to handle the inevitable problems that arise when switching from one window to another, when performing clipboard operations, and so on.

 

Adding delays to a script is the path of least resistance. The approach is effective most, but not all of the time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...