[SUGGESTION] If TAG exists
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
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
[SUGGESTION] If TAG exists
Dear Danial / Hannes,
I would like to suggest an improvement to imacros, by adding conditional statement which should be easy to implement.
How about adding an "IF TAG.." statement followed with "END IF TAG.." where the statements between both these commands are executed if a particular tag exists otherwise imacros skips it. Also, commands like "ELSE IF TAG" can be incorporated which executes statements when the tag does not exist and if possible you can check suitability of nested ifs also.
This will greatly enhance the suitability of imacros
currently for doing it with scripting we have to send 3 macros to the open imacros window i.e.
1st macro do some work
2nd macro check if tag exists i.e. if tag is found
3rd send macro commands depending on the result of 2nd
and you can of course visualize the scenario where more than one if statements or nested if statements are required based on tag results.
hope this is feasibility for implementation as it increases the utility of imacros by a great extent.
regards,
CooooL
PS: Daniel I have posted source code of Imacros Testing Environment also just have a look
I would like to suggest an improvement to imacros, by adding conditional statement which should be easy to implement.
How about adding an "IF TAG.." statement followed with "END IF TAG.." where the statements between both these commands are executed if a particular tag exists otherwise imacros skips it. Also, commands like "ELSE IF TAG" can be incorporated which executes statements when the tag does not exist and if possible you can check suitability of nested ifs also.
This will greatly enhance the suitability of imacros
currently for doing it with scripting we have to send 3 macros to the open imacros window i.e.
1st macro do some work
2nd macro check if tag exists i.e. if tag is found
3rd send macro commands depending on the result of 2nd
and you can of course visualize the scenario where more than one if statements or nested if statements are required based on tag results.
hope this is feasibility for implementation as it increases the utility of imacros by a great extent.
regards,
CooooL
PS: Daniel I have posted source code of Imacros Testing Environment also just have a look
Re: [SUGGESTION] If TAG exists
I totally agree with this. A simple IF statement would make life easier for us.
Larry
Larry
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: [SUGGESTION] If TAG exists
Hi,
Thank you very much for the suggestion! I am sorry for only coming back to you now.
We are thinking of what we can do to add some control flow logic without creating a new complex programming language. And any ideas are very welcome! I will forward this one to our developers now.
Thanks again,
Thank you very much for the suggestion! I am sorry for only coming back to you now.
We are thinking of what we can do to add some control flow logic without creating a new complex programming language. And any ideas are very welcome! I will forward this one to our developers now.
Thanks again,
Daniel, iOpus Support
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: [SUGGESTION] If TAG exists
@Daniel
I should be the one thanking the whole imacros team for this great software, I have created a couple of bots using c# with imacros and its really easy as compared to doing a bot in c# alone
regards
I should be the one thanking the whole imacros team for this great software, I have created a couple of bots using c# with imacros and its really easy as compared to doing a bot in c# alone
regards
Re: [SUGGESTION] If TAG exists
Use
ActiveDocument.SelectContentControlsByTag("XXXX").Count
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 0 (There is no Content Control tagged "XXXX")
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 1 (There is only one Content Control tagged "XXXX")
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 2 (There are two different Content Control tagged "XXXX")
... and so on.
ActiveDocument.SelectContentControlsByTag("XXXX").Count
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 0 (There is no Content Control tagged "XXXX")
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 1 (There is only one Content Control tagged "XXXX")
if ActiveDocument.SelectContentControlsByTag("XXXX").Count = 2 (There are two different Content Control tagged "XXXX")
... and so on.
Last edited by Jonjozz on Sat Aug 02, 2014 8:35 pm, edited 1 time in total.
Re: [SUGGESTION] If TAG exists
or then
Dim CC As ContentControls
' Get the collection of all content controls with this tag.
Set CC = ActiveDocument.SelectContentControlsByTag("Thing")
' If any content controls are found iterate through them and give the type.
If CC.Count = 0 Then ‘ The content control tagged "Thing" doesn´t exist.
If CC.Count = 1 Then ‘ There is only one content control tagged "Thing".
If CC.Count = 2 Then ‘ There are 2 different content control tagged "Thing".
… and so on
If CC.Count <> 0 Then ‘The content control tagged "Thing" exists (It could be one or more, but there is at least one Content Control tagged "Thing").
Dim CC As ContentControls
' Get the collection of all content controls with this tag.
Set CC = ActiveDocument.SelectContentControlsByTag("Thing")
' If any content controls are found iterate through them and give the type.
If CC.Count = 0 Then ‘ The content control tagged "Thing" doesn´t exist.
If CC.Count = 1 Then ‘ There is only one content control tagged "Thing".
If CC.Count = 2 Then ‘ There are 2 different content control tagged "Thing".
… and so on
If CC.Count <> 0 Then ‘The content control tagged "Thing" exists (It could be one or more, but there is at least one Content Control tagged "Thing").