Search w/ Regexp Troubles

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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
Tempfire
Posts: 6
Joined: Fri May 09, 2014 5:12 pm

Search w/ Regexp Troubles

Post by Tempfire » Mon May 19, 2014 7:45 pm

Hello all,

I'm having trouble with a search call using regexp with the imacros/ie browser to retrieve the full source of a webpage.

My automation is with c# ... the rest of the application works great.

Imacros version ... VERSION BUILD=10002738
Browser Versions ...
IE v10.0.14
CR v34.0.1847.137 m

I found http://forum.imacros.net/viewtopic.php?f=7&t=11200, which gives 2 different methods for pulling the full web page source out of a SEARCH statement.

1) SEARCH SOURCE=REGEXP:"(?s)(.*)" EXTRACT="$1" ... doesn't seem to work anywhere
2) SEARCH SOURCE=REGEXP:"([\s\S]*)" EXTRACT="$1" ... seems to work in Chrome, but not the iMacros Browser / Internet Explorer ... it however does lockup the chrome browser on occasion.
and
3) TAG POS=1 TYPE=HTML ATTR=TXT:* EXTRACT=HTM ... I don't like the output of this approach

What I really want is a SEARCH line that I can plug into a dynamically built macro that will give me the full sourcecode of a webpage.

My ultimate goal is to know when a search form returns ... the problem is that the search form is submitted with a javascript overlay that gives an "in-progress" type of spinning wheel. Once the search is complete the information is most likely returned into an embedded DIV so the page doesn't really "reload". So what I'd like to do is get the full sourcecode of the original page before the search button is clicked, and then get it again after a set amount of time and compare the 2.

Here's the basic code that I'm using to setup a while true loop in c# to constantly monitor the source to know when it changes ...

Code: Select all

                    s = mApp.iimPlayCode(Constants.Search);

                    while (true)
                    {
                        s = mApp.iimPlayCode(Constants.WaitforSearch, 5);
                        System.Threading.Thread.Sleep(5000);
                        extract = mApp.iimGetLastExtract();

                        if (extract.ToString() != first_page)
                        {
                            break;
                        }
                    }
and here is the c# "constant" ... notice I've tried all 3 versions of the search .. *note the \\'s are because the \ is a .NET escape character as well ...

Code: Select all

        internal const string WaitforSearch = 
            "VERSION BUILD=10002738" + "\r\n" + 
            "TAB T=1" + "\r\n" + 
            "TAB CLOSEALLOTHERS" + "\r\n" + 
            "WAIT SECONDS=4" + "\r\n" +
            //"TAG POS=1 TYPE=HTML ATTR=TXT:* EXTRACT=HTM" + "\r\n" +
            //"SEARCH SOURCE=REGEXP:\"(?s)(.*)\" EXTRACT=\"$1\"" + "\r\n" +
            "SEARCH SOURCE=REGEXP:\"([\\s\\S]*)\" EXTRACT=\"$1\"" + "\r\n" + 
            "";
Any help would be appreciated, I'm banging my head on this when I should be coding ;)

Thanks all ...

DJW
Last edited by Tempfire on Wed May 21, 2014 12:55 pm, edited 1 time in total.
Tempfire
Posts: 6
Joined: Fri May 09, 2014 5:12 pm

Re: Search w/ Regexp Troubles

Post by Tempfire » Mon May 19, 2014 8:11 pm

Here's something interesting ... if I use : PROMPT {{!EXTRACT}} it will show up in the editor like an extract preview ... so I'm going to try and figure out how to incorporate this ... just making notes on the process as I figure / don't figure out my problem for future folks :)
Post Reply