Page 1 of 1

revBrowser Inconsistencies

Posted: Tue Jun 08, 2010 12:52 am
by lohill
Can anyone offer a reason or set of reasons why the following mouseUp script works on the Macintosh but not on a PC. On the Mac the rect shows the browser and answers with the Last Trade price from Yahoo. On a PC the rect looks good but the message about not being able to connect to Yahoo is shown. Additionally tString in debug mode is different in the different environments.

Code: Select all

on mouseUp
   local tBrowserId
   put "http://finance.yahoo.com/q?s=AAPL"  into tURL
   put revBrowserOpen(the windowId of this stack, tURL) into tBrowserId
   revBrowserSet tBrowserId, "rect", "10,50,500,500"
   if tBrowserId is not an integer then
      answer "Failed to open browser"
      exit mouseup
   end if
   wait 10 seconds
   put revBrowserGet(tBrowserId, "htmltext") into tString
   put offset("Last Trade:",tString) into tStart
   If tStart > 0 then
      put char tStart to tStart + 250 of tString into tResult
      put offset("<span",tResult) into tStart
      put char tStart+7 to -1 of tResult into tResult
      put offset("</span>",tResult) into tStart
      put char 1 to tStart-1 of tResult into tResult
      replace ">" with space in tResult
      put last word of tResult into tResult
      answer tResult
   else
      answer warning "Error connecting to Yahoo Quote."
   end if
   revBrowserClose tBrowserID
end mouseUp
Thanks in advance for any light you can shed on this.
Regards,
Larry

Re: revBrowser Inconsistencies

Posted: Tue Jun 08, 2010 11:54 am
by bangkok
My mistake : i've got the error message too.

Same result with RunRev 3.5 and 4.5.

It seems related to the webpage.

With another webpage
put revBrowserGet(tBrowserId, "htmltext") into tString
is working.

Idea : why don't you use :
put "http://finance.yahoo.com/q?s=AAPL" into tURL
put url tURL into toBeAnalysed
put offset("Last Trade:",tString) into tStart

it's working fine.

Re: revBrowser Inconsistencies

Posted: Tue Jun 08, 2010 5:16 pm
by lohill
bangkok,

I'm sure you must have meant this for your 'idea':

put "http://finance.yahoo.com/q?s=AAPL" into tURL
put url tURL into toBeAnalysed
put offset("Last Trade:",toBeAnalysed) into tStart

Interestingly enough this is the way I started in my project and for this URL it worked just fine both on the Mac and the PC. The problem came with the URL I really wanted to use: http://www.investors.com/StockResearch/ ... ymbol=AAPL. I was not able to get that one to work with either the Mac or the PC because of the nature of the URL. The page I really wanted to get data from requires that the user to log on and instruct the browser to remember it. Here are some references to other threads that I started on this topic:
http://forums.runrev.com/phpBB2/viewtop ... =11&t=5197
http://forums.runrev.com/phpBB2/viewtop ... f=8&t=5221
http://forums.runrev.com/phpBB2/viewtop ... f=8&t=5313

If you look at those, you can see I've been all over the map looking for a solution but not finding anything. I have learned a lot though.
The last one got me started on revBrowser where I immediately was able to get what I wanted working on a Mac. The same code would not work on a PC however. Then I noticed the even with a simple URL like the one from Yahoo would not work on a PC hence I started this thread. To me this clearly points out REV's inconsistent behavior. For me these inconsistencies are more the rule than the exception.

Regards,
Larry