Page 1 of 1
Suppress Error Messag
Posted: Thu Dec 23, 2010 12:25 am
by lohill
The following mouseUp script causes a 'button' on a web page to be 'clicked'.
Code: Select all
on mouseUp
global gPbrowserId
put "animalListForm:j_id58" into tId -- This is the Add New button on the animals page
put "document.getElementById('" & tID & "').click();" after tScript
put revBrowserExecuteScript(gPBrowserId, tScript) into tResult -- tResult is empty with success otherwise error message from Explorer
end mouseUp
This seems to work fine as long as it is executed when I'm on the web page that contains the 'Add New' button. If it is executed on a web page that does not contain the 'Add New' button then an error message comes up. I would prefer that no message would be displayed and I could just look in tResult for success or failure.
I first tried lock messages and lock error dialogs but that didn't seem to do the trick. Then I read the message carefully and saw that it was being sent by Explorer. That led me in Explorer to the Tools Menu-InternetOptions-Advanced where I put a check next to 'Disable script debugging' and removed the check from 'Display a notification about every script error'. That didn't seem to do the job either.
Does anyone have another suggestion that might prove to work?
Thanks in advance,
Larry
Re: Suppress Error Messag
Posted: Mon Jan 10, 2011 1:39 am
by Mark
Hi Larry,
Maybe this or a similar solution will work:
Code: Select all
on mouseUp
if revBrowserGet(gPBrowserID,"htmltext") contains "Add New" then
-- your script here
else beep
end mouseUp
Kind regards,
Mark
Re: Suppress Error Messag
Posted: Fri Jan 14, 2011 8:20 pm
by lohill
Hi Mark,
You suggestion of revBrowserGet(gPBrowserID, "htmltext") would be ideal if it would only work for the type of web page I am dealing with. In the past few months I have run across a number of situations where that command returns little or nothing for me. It seems that some of the revBrowser commands fail to work as advertised. I have tried many things to work around these problems including having the user select and copy data from the page and then using clipBoardData["text"} to get at what I want. But most of the work-arounds lead to a much more unfriendly user interface.
I filed a bug report (#8833) back in June that demonstrates this problem in a very simple situation. After waiting for a couple of months I asked 'quality control' if they had seen my report. They assured me they had and mentioned something about 'new policy'. It has been four month more and I have heard nothing. I find it very frustrating that the organization responsible for LiveCode spends all their time trying to invent new products to sell me when the ones that I have already licensed do not work as they claim they will.
Sorry for the rant and thank you for trying to be helpful.
Regards,
Larry
Re: Suppress Error Messag
Posted: Fri Jan 14, 2011 8:25 pm
by Mark
Hi larry,
I know what you mean and I agree that it is extremely frustrating to run into bugs like these. Due to such things, which you'd expect to "just work", I often spend many hours on a job that should take only minutes.
Having said that, there often is a workaround. You might get the URL and retrieve the data from the url again using the put command, to see which site is currently open. There may be other possibilities.
Also, keep in mind that websites may be designed to prevent people from hacking a website. I don't know what kind of site you are dealing with, but the web developer might have successfully tried to keep you out.
Kind regards,
Mark
Re: Suppress Error Messag
Posted: Fri Jan 14, 2011 11:15 pm
by lohill
Hi Mark,
You might get the URL and retrieve the data from the url again using the put command, to see which site is currently open.
I'm not sure what you are saying here. Do you have an example you can elaborate with here?
Thanks,
Larry
Re: Suppress Error Messag
Posted: Fri Jan 14, 2011 11:55 pm
by Mark
Larry,
That would be something like
Code: Select all
put revBrowserGet(x,"url") into myUrl
put url myUrl into myData
if "Add New" is in myData then
-- do the click here
end if
Best,
Mark
Re: Suppress Error Messag
Posted: Sat Jan 15, 2011 1:18 am
by lohill
Mark,
You are a genius! That was exactly what was needed. I have many places to try that in my various projects.
Thanks for bearing with me.
Larry
Re: Suppress Error Messag
Posted: Sat Jan 15, 2011 5:59 am
by mwieder
<g> happy ending.