'If error, then...' function. Help needed!

Hi there,

I am trying to create an autofollow macro, that selects only users I don’t follow, and then scrolls down the page. I want to avoid ‘Following’ button, and select only ‘Follow’ option, so I jumped straight to XClick option to find that button but unfortunately the macro stops when there are no options to follow (everyone is already followed). I didn’t succeed with Kantu either. But I would love this macro to detect these users and then scroll down the page, so I thought that I should implement “if error, then…”, however no success either. Here is a code for one user to add with XModule:

{
  "Name": "1-1",
  "CreationDate": "2020-5-25",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.manyvids.com/Social/hidori/97815/Followers/",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "6rkn8o_dpi_192.png",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_PAGE_DOWN}${KEY_PAGE_DOWN}${KEY_PAGE_DOWN}${KEY_PAGE_DOWN}",
      "Value": ""
    }
  ]
}

With Kantu it looks like these:

{
“Command”: “click”,
“Target”: “xpath=//[@id="social-app"]/div/div[2]/div[1]/div[4]/button",
“Value”: “”
},
{
“Command”: “click”,
“Target”: "xpath=//
[@id="social-app"]/div/div[2]/div[2]/div[4]/button”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//*[@id="social-app"]/div/div[2]/div[3]/div[4]/button”,
“Value”: “”
},

That I think is the way longer if I need to follow 10000 users, I guess I will need to create the same amount of lines.

Thank you for help!

The very easy solution is desktop automation you set errorignore YES and the image of button not clicked (follow) and a KEY_DOWN to scrool the page.

You can try to detect the button with text this skip the clicked button (with this mode you can use web automation only).

Don’t need if or similar solution with this method.

It seems an easy works to to.

1 Like

See also If {picture} then {do this}

1 Like

Rookie mistake.
You don’t want an “if”. you want a “while”.

While buttonFollow exists
Then click Follow
Else
PgDown
While buttonFollow exists
Then click Follow
Else

PageDown
Click NextPage

You can check documentation and use it to write in the correct syntax, but you can get the idea.
Also, I’d use Mouse.ScrollDown instead of PageDown, because it is smoother to scroll.

1 Like

Why need while of if ?

Optimize macro code and you do not need any if or while and you have a short and fast macro code.

Remember good coder is who create macro in few line of codes, few lines is little chance to freeze or errors and macro most stable and fast.

Detect button not click (with text) or image and click these only simple and fast solution (need 10 minutes to create this macro).

I already create similar macro without any problem in few line of codes in loop.

1 Like

The amount of time each person puts on a work has a lot of variables. If he’s using a “if” statement he haven’t managed to figure out a no-statement code. He can complete his macro in a simple way, and then improve it later.
That’s how I personally do, too. If you don’t have a start point, it’s hard to reach somewhere else.

OK, mine is a suggestion only.

I automate from long time and i see the simple and short macro code works better.

1 Like

Thanks for the link! Was really helpful!

yes that what I want :slight_smile: can anybody help me?

and how I must do it?

yes its clear what this macro should do and the steps but how to create its not easy and its not what the product say without coding, its only coding or? I look YouTube videos what they show and show “how easy” but after 6 hours I create nothing what work… makes me sad :frowning:

right frustrating at the end not only hard :slight_smile: but it reads you can it? can you help me?

Hello could you help me make this marco to my computer i could pay you for the script.

Hello could you help me make this marco to my computer i could pay you for the script.

hello could youj help me with this script i can pay you

Add info, screen, details about the work to do please