Suppress Error Messag

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Suppress Error Messag

Post by lohill » Thu Dec 23, 2010 12:25 am

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Suppress Error Messag

Post by Mark » Mon Jan 10, 2011 1:39 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Suppress Error Messag

Post by lohill » Fri Jan 14, 2011 8:20 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Suppress Error Messag

Post by Mark » Fri Jan 14, 2011 8:25 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Suppress Error Messag

Post by lohill » Fri Jan 14, 2011 11:15 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Suppress Error Messag

Post by Mark » Fri Jan 14, 2011 11:55 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Suppress Error Messag

Post by lohill » Sat Jan 15, 2011 1:18 am

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

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Suppress Error Messag

Post by mwieder » Sat Jan 15, 2011 5:59 am

<g> happy ending.

Post Reply