Conditional Statements in iMacros sidebar for IE

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
sgibbs77
Posts: 4
Joined: Thu Sep 28, 2017 12:51 pm

Conditional Statements in iMacros sidebar for IE

Post by sgibbs77 » Thu Sep 28, 2017 1:01 pm

I don't know if the is the proper location to post this, but I have a macro that runs through a set of various links and downloads data to my computer from a website. However, there are times when some of the links are not there. Right now, to get around this, I have to visually check to see which links are there and comment out the code for the links that are not there. Is there any way, given that I'm using the iMacros sidebar version for IE, to do a check to see if the link is there and skip past it if it is not? Here is a sample of the code below:

TAG POS=1 TYPE=A ATTR=TXT:Commissions
FRAME F=1
TAG POS=1 TYPE=A ATTR=TXT:Postpaid<SP>Activation
TAG POS=1 TYPE=A ATTR=TXT:Smart<SP>Phone<SP>Activation this is the "link" that the macro "clicks" to get that set of data; it may or may not exist at any given time; I need to know how to get around it
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
TAG POS=1 TYPE=SPAN ATTR=TXT:Generate<SP>Export<SP>File
TAG POS=2 TYPE=SPAN ATTR=TXT:Yes
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
ONDOWNLOAD FOLDER=C:\Users\AWC\Dropbox\Commissions\New<sp>Activations FILE=Smartphone<sp>New<sp>Activation<sp>Commission.xlsx WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Download<SP>Export<SP>File
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=TXT:Postpaid<SP>Activation<SP>Summary if the first link does not exist; it would need to skip down to this line of code
FRAME F=1
TAG POS=1 TYPE=A ATTR=TXT:Feature<SP>Phone<SP>Activation
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
TAG POS=1 TYPE=SPAN ATTR=TXT:Generate<SP>Export<SP>File
TAG POS=2 TYPE=SPAN ATTR=TXT:Yes
WAIT SECONDS=8
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
ONDOWNLOAD FOLDER=C:\Users\AWC\Dropbox\Commissions\New<sp>Activations FILE=Feature<sp>New<sp>Activation<sp>Commission.xlsx WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Download<SP>Export<SP>File
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Conditional Statements in iMacros sidebar for IE

Post by chivracq » Thu Sep 28, 2017 1:39 pm

sgibbs77 wrote:I don't know if the is the proper location to post this, but I have a macro that runs through a set of various links and downloads data to my computer from a website. However, there are times when some of the links are not there. Right now, to get around this, I have to visually check to see which links are there and comment out the code for the links that are not there. Is there any way, given that I'm using the

Code: Select all

iMacros sidebar version for IE
, to do a check to see if the link is there and skip past it if it is not? Here is a sample of the code below:

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:Commissions
FRAME F=1
TAG POS=1 TYPE=A ATTR=TXT:Postpaid<SP>Activation
TAG POS=1 TYPE=A ATTR=TXT:Smart<SP>Phone<SP>Activation [b]this is the "link" that the macro "clicks" to get that set of data; it may or may not exist at any given time; I need to know how to get around it[/b]
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
TAG POS=1 TYPE=SPAN ATTR=TXT:Generate<SP>Export<SP>File
TAG POS=2 TYPE=SPAN ATTR=TXT:Yes
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
ONDOWNLOAD FOLDER=C:\Users\AWC\Dropbox\Commissions\New<sp>Activations FILE=Smartphone<sp>New<sp>Activation<sp>Commission.xlsx WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Download<SP>Export<SP>File
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=TXT:Postpaid<SP>Activation<SP>Summary [b]if the first link does not exist; it would need to skip down to this line of code[/b]
FRAME F=1
TAG POS=1 TYPE=A ATTR=TXT:Feature<SP>Phone<SP>Activation
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
TAG POS=1 TYPE=SPAN ATTR=TXT:Generate<SP>Export<SP>File
TAG POS=2 TYPE=SPAN ATTR=TXT:Yes
WAIT SECONDS=8
TAG POS=1 TYPE=SPAN ATTR=CLASS:icn<SP>rIcn<SP><SP>arrow-south-white-small
ONDOWNLOAD FOLDER=C:\Users\AWC\Dropbox\Commissions\New<sp>Activations FILE=Feature<sp>New<sp>Activation<sp>Commission.xlsx WAIT=YES
TAG POS=1 TYPE=SPAN ATTR=TXT:Download<SP>Export<SP>File
Yep, the 'General' Sub-Forum is the correct one for your Thread... (and always the one to choose if you are unsure...).

FCIM...! :mrgreen: (Read my Sig..., always mention your FCI when you open a Thread, many Commands are not implemented for all Browsers/Versions...)
=> iMacros for IE v...?, IE v...?, OS...?

But yep, simply use '!ERRORIGNORE' I would think, combined with a short '!TIMEOUT_STEP' (=1 or 0) to avoid waiting for the Default 6 sec for each 'TAG' Statement that won't do anything probably if the Link was not found in the Frame...

If those Statements might still click some "unwanted" Elements in the Frame, you would then need to first check with 'EXTRACT' if the Link is present before actually clicking on it if it's there, to then with 'EVAL()' spit out a "1"/"0" to reuse for the Statements you want to "mute" with "TAG POS={{!VAR1}}". ('TAG POS=0' won't do anything...)

And you can use the same Principle if you want on the 'WAIT=10 sec" Statement for a "Conditional 'WAIT'", if you don't want your Script to wait for 10 sec if the Link was not there...
- (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...
sgibbs77
Posts: 4
Joined: Thu Sep 28, 2017 12:51 pm

Re: Conditional Statements in iMacros sidebar for IE

Post by sgibbs77 » Fri Oct 06, 2017 3:48 pm

Thank you for the response. I'm using the iMacros for IE version 11. It's the Freeware version on a Windows 8.1. If you wouldn't mind, could you provide an example of what you are talking about given the code I used? I'm a bit of a novice at using this, as all my macros were recorded using mouse clicks and some simple knowledge of how to code using the language. I greatly appreciate it!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Conditional Statements in iMacros sidebar for IE

Post by chivracq » Fri Oct 06, 2017 6:09 pm

sgibbs77 wrote:Thank you for the response. I'm using the

Code: Select all

iMacros for IE version 11.  It's the Freeware version on a Windows 8.1.
If you wouldn't mind, could you provide an example of what you are talking about given the code I used? I'm a bit of a novice at using this, as all my macros were recorded using mouse clicks and some simple knowledge of how to code using the language. I greatly appreciate it!
Ah OK, some Follow-up 1 week later... :D

Hum, your FCI is still unclear..., "iMacros for IE version 11" does exist but it's a "strange" Version to use, more common would be v11.5, or even v12.0 which got released about 1 month ago, depending on when you started using iMacros... And your IE Version (the Version of the Browser itself) is still missing...

But no, I won't be writing your Script, I'll help you if you get "really" stuck but you need to do your "part of the job" and to try stg..., you already have maybe 100 Examples on the Forum if you search the Forum a bit (on my Posts for example with "Conditional" + "WAIT" or "spit out" or anything that can be "Conditional"...).
Have a look at this Thread for example where I explained the "Principle" and different "Techniques" you can use and where I maintain a List of relevant/interesting Threads...:
- Workarounds for Conditional Logic in Macro Code

But, this is a bit your "lucky day" though I guess, I actually just wrote a Script for a very similar Scenario like yours for some other Thread/User (who really did his best to find a Solution by himself, ah-ah...!):
- Re: How to use EVAL to Stop the Macro when there is no Next?

That should get you nicely started I reckon...!? 8)

Hum, and try to mention a bit clearly the 3 exact Versions for your Env., I normally don't react to Threads when your FCI is not mentioned clearly and completely...
And try to follow up a bit quicker than in one week again... I don't remember after 1 week what your Thread was about and I have to read it all over again.. :idea:
OK, good luck and post your Final Script... :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...
sgibbs77
Posts: 4
Joined: Thu Sep 28, 2017 12:51 pm

Re: Conditional Statements in iMacros sidebar for IE

Post by sgibbs77 » Fri Oct 06, 2017 6:20 pm

I only replied today because I was not aware of the reply that you had provided earlier. My version of IE is version 11. I have not gotten the updated version of the iMacros sidebar, so I did not realize there were new versions of it. I will try looking at the links you provided to see if they help. I was not expecting you to do the work for me, just looking for an example. I have never created an iMacro macro from scratch by typing the code myself. As I stated, I've only built macros with mouse clicks.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Conditional Statements in iMacros sidebar for IE

Post by chivracq » Fri Oct 06, 2017 7:33 pm

sgibbs77 wrote:I only replied today because I was not aware of the reply that you had provided earlier. My version of IE is version 11. I have not gotten the updated version of the iMacros sidebar, so I did not realize there were new versions of it. I will try looking at the links you provided to see if they help. I was not expecting you to do the work for me, just looking for an example. I have never created an iMacro macro from scratch by typing the code myself. As I stated, I've only built macros with mouse clicks.
Oh well, you have some 'Notify me when a reply is posted' Option when you open a Thread or post any Msg in a Thread to get some automatic Notification (per E-mail I think), like on most Forums, especially built in PHPBB like this one...

Hum, well, if you have iMacros for IE v11.0 and it works fine for you, then there is no need to change then, even if I think that a few "cool" new Functionalities/Commands were introduced in v11.5, but they were maybe more "interesting" for a bit more "Advanced" Users...

But hum, about your Case, you probably don't even need any Conditional Logic in your Script, I already mentioned '!ERRORIGNORE' and a short '!TIMEOUT_STEP', you should try that first..., this is the most "plausible" and easiest Solution very probably...
- (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