Using IF ELSE in a macro

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
ssl2k
Posts: 3
Joined: Tue Jun 15, 2021 1:54 pm

Using IF ELSE in a macro

Post by ssl2k » Tue Jun 15, 2021 2:12 pm

Hi, this is my first post, and i have been reading past posts on this topic but still couldn't apply what I have read into my scenario.

I'm currently using Windows 10, Google Chrome ver91 (the latest release, i always kept it up to date), and iMacros extension in chrome (version 10.1.1)
This is the website im using iMacros on: Shopee Malaysia

The product i want to buy is currently out of stock, but it is accessible when the seller re-lists it and then restocks at a fixed time. At that time, the stock will be "0 piece available"
This is an example product page Controller for Switch (so you can get the picture) and i want it to be able to check the stock amount. if it is "0 piece available", i want it to GOTO the first line which reloads the page and then performs the IF ELSE statement again. basically i want the statement to be:
if (stock == 0):
refreshpage
else:
proceed with the remaining lines

is it possible to do this on iMacros extension or do i have to resort to the paid version? Thank you for all the help.
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:38 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Tue Jun 15, 2021 2:32 pm

ssl2k wrote:
Tue Jun 15, 2021 2:12 pm
Hi, this is my first post, and i have been reading past posts on this topic but still couldn't apply what I have read into my scenario.

I'm currently using Windows 10, Google Chrome ver91 (the latest release, i always kept it up to date), and iMacros extension in chrome (version 10.1.1)
This is the website im using iMacros on: Shopee Malaysia

The product i want to buy is currently out of stock, but it is accessible when the seller re-lists it and then restocks at a fixed time. At that time, the stock will be "0 piece available"
This is an example product page Controller for Switch (so you can get the picture) and i want it to be able to check the stock amount. if it is "0 piece available", i want it to GOTO the first line which reloads the page and then performs the IF ELSE statement again. basically i want the statement to be:

Code: Select all

if (stock == 0):
    refreshpage
else:
    proceed with the remaining lines
is it possible to do this on iMacros extension or do i have to resort to the paid version? Thank you for all the help.

=> FCI:

Code: Select all

iMacros for CR v10.1.1, 'Free', CR91, Win10.
You are a bit "in luck", some other User had recently more or less the same Scenario/Requirements for a Script on the same Site...: 8)
- What script to refresh the page until the item is available
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:38 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
ssl2k
Posts: 3
Joined: Tue Jun 15, 2021 1:54 pm

Re: Using IF ELSE in a macro

Post by ssl2k » Tue Jun 15, 2021 2:41 pm

If i understood it correctly, that means by using the ERRORIGNORE, i should be able to loop the script even if the buy now button is disabled right? so when the next loop comes, hopefully by then it has restocked.

tell me if im wrong :)
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:39 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Tue Jun 15, 2021 2:49 pm

ssl2k wrote:
Tue Jun 15, 2021 2:41 pm
If i understood it correctly, that means by using the ERRORIGNORE, i should be able to loop the script even if the buy now button is disabled right? so when the next loop comes, hopefully by then it has restocked.

tell me if im wrong :)

Yep, that's correct..., but you need to read the whole Thread and understand how the User "progressed" towards their Final Script and getting it to work... :idea:

And that other User also wanted a Mechanism to increment the Number of "Piece(s) available" to only click on the 'Buy now' Button if there were at least 2 Items available... Not sure if you want that Mechanism as well... :|
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:39 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
ssl2k
Posts: 3
Joined: Tue Jun 15, 2021 1:54 pm

Re: Using IF ELSE in a macro

Post by ssl2k » Tue Jun 15, 2021 2:54 pm

i had no problems on incrementing the quantity. Only needed the "buy when its in stock" part of the script :D Thank you a lot, by the way!
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:39 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Tue Jun 15, 2021 3:01 pm

ssl2k wrote:
Tue Jun 15, 2021 2:54 pm
i had no problems on incrementing the quantity. Only needed the "buy when its in stock" part of the script :D Thank you a lot, by the way!

Alright, perfect then if the Script from the "other" Thread already works for you as well... :D

Thanks to the other User then, I would think..., they did all the "hard Work" already, ah-ah...! :wink:
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:40 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Sat Jun 19, 2021 5:01 pm

Posting on behalf of a "New" User:
Re: IF ELSE using iMacros on an e-commerce website
Post by kimwelnes » 19/06/2021 - 17:57
Post awaiting approval: [Disapprove] - [Approve]

I also have the same problems. Thanks for the solutions.

EDIT: Oh...!, the User is Fake indeed, like I suspected, they've already tried (1 day later) to post another fake "Thanks, #MeToo" in some other Thread...
But OK, I leave this Quote as "Explanation" for the 2nd Part of my Post, and the User will be deleted during the next "Clean-up Round", no big deal... :|

>>>

Alright, looks like this Thread is already attracting some "Low Quality" Posts with "Thank you. #MeToo"..., but I "usually" don't approve such Low Qlt Posts as they "usually" all turn out to be "Fake", from "Fake" Users and (future) Spammers and I don't want to have to monitor those Users until they will invariably silently edit their Post (or Sig) "one day" to add some Spam... :shock:

=> For New Users who would like to post in this Thread, make sure to put "a bit more" Quality than the one in this Quote, by including your Final Script and mentioning your FCI, to add any "Value" to this Thread... :idea:
And make sure to register to the Forum from a "clean" and "real" IP. => Using a VPN or Proxy for example is a No Go, sorry... :!:
And your IP should "match" the Country/Language of the Site... I don't "expect" a User with some Russian IP for example to speak Malaysian, ah-ah...! :P
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:40 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Wed Sep 29, 2021 1:33 pm

chivracq wrote:
Sat Jun 19, 2021 5:01 pm
Alright, looks like this Thread is already attracting some "Low Quality" Posts with "Thank you. #MeToo"..., but I "usually" don't approve such Low Qlt Posts as they "usually" all turn out to be "Fake", from "Fake" Users and (future) Spammers and I don't want to have to monitor those Users until they will invariably silently edit their Post (or Sig) "one day" to add some Spam... :shock:

=> For New Users who would like to post in this Thread, make sure to put "a bit more" Quality than the one in this Quote, by including your Final Script and mentioning your FCI, to add any "Value" to this Thread... :idea:
And make sure to register to the Forum from a "clean" and "real" IP. => Using a VPN or Proxy for example is a No Go, sorry... :!:
And your IP should "match" the Country/Language of the Site... I don't "expect" a User with some Russian IP for example to speak Malaysian, ah-ah...! :P

=> Yep indeed, this Thread keeps regularly attracting "Fake" Users and Spammers, => I'm asking the Forum Admin to lock the Thread... :roll:

=> For New Users with a similar Scenario or some "Follow-up Qt", open your own Thread and you can always link to this one... :idea:
Make sure to read the Forum Rules and to put some Quality in your Thread, => by selecting the "correct" Sub-Forum (will be the 'General' or the 'Data Extraction' one), + Descriptive Thread Title and mentioning your FCI... :!:
Last edited by Tom, Tech Support on Fri Oct 01, 2021 2:41 pm, edited 1 time in total.
Reason: Removing spammy keywords from title
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Using IF ELSE in a macro

Post by Tom, Tech Support » Fri Oct 01, 2021 2:42 pm

chivracq wrote:
Sat Jun 19, 2021 5:01 pm
=> Yep indeed, this Thread keeps regularly attracting "Fake" Users and Spammers, => I'm asking the Forum Admin to lock the Thread... :roll:
I've changed the thread subject/title. If it continues to be a magnet for spammers just re-report it and I'll lock it down.
Regards,

Tom, iMacros Support
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Using IF ELSE in a macro

Post by chivracq » Fri Oct 01, 2021 2:47 pm

Tom, Tech Support wrote:
Fri Oct 01, 2021 2:42 pm
chivracq wrote:
Sat Jun 19, 2021 5:01 pm
=> Yep indeed, this Thread keeps regularly attracting "Fake" Users and Spammers, => I'm asking the Forum Admin to lock the Thread... :roll:
I've changed the thread subject/title. If it continues to be a magnet for spammers just re-report it and I'll lock it down.

Alright, that's a "Solution" indeed, let's hope 'Google Cache' won't be voiding it..., but OK, I'll let you know if some further Action is "needed"...
Thanks @Tom... :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply