Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

web viewer google translate, eventually crashes filemaker

Featured Replies

Hi All,

 

So from Brian Dunning's website, I found that you can use the following URL to put google translate into a web viewer:

"http://translate.google.com/translate_t?hl=en&sl=en&tl=de&text="&FieldName

where FieldName is the english text which you want translated and you can change "de" to zh-CN or other supported languages.  This seems to work well and using the following function

Let(
[htmlcontent = GetLayoutObjectAttribute ( "google_translate"; "content" );
tran_result_start = Position ( htmlcontent; "TRANSLATED_TEXT="; 1; 1);
first_quote = Position (htmlcontent; "'";tran_result_start;1);
second_quote = Position (htmlcontent; "'";tran_result_start;2)
];
Middle ( htmlcontent; first_quote+1; second_quote-first_quote-1)
)

I can grab the part of the resulting web page that has the translated text.  So I proceeded to script this with a page refresh to get the content to get in the function, and a one second pause in the loop prior to getting values to allow the web viewer to work.  This seems to work well, except for the fact that after ~100 records, Filemaker will crash with a C++ runtime exception.  I guess this is due to gobbling up so much memory or too many processes from all the web viewer content.

 

Is there a way around this other than doing 75 records at a time and quitting Filemaker in between?

 

Thanks,

 

Dana

I had a similar problem when running in a Windows environment.  The problem seemed to be that the web viewer was using Internet Explorer, and each time you moved to a different record, another IE session was created. Eventually the computer ran out of memory and crashed Filemaker.

 

One possible way around this might be to place the web viewer on a separate table, alter the URL FieldName value as you step through each record in the main table, and copy the result back into the main table.  This way you should only have one instance of the web viewer, not one per record.

 

Brian

  • Author

that sounds like a good idea!  I'll give that a try and report back.

 

Thanks,

 

Dana

Is there a way around this ...?

 

Yes, there is.

Do not use the web viewer but instead use the new ( only on 12 ) script step: Insert from URL

That is really cool! Here's a formula to parse out the translated text from all that junk:

Let([
  txt = yourGoogleResultField ;
  start = "TRANSLATED_TEXT='" ;
  end = "';" ;
  pos1 = Position ( txt ; start ; 1 ; 1 )+ Length( start ) ;
  pos2 = Position ( txt ; end ; pos1 ; 1 ) ;
  result = Middle ( txt ; pos1 ; pos2 - pos1 )
 ] ;
  result
)
The calculation is a little more complex but above all you need to edit the URL ( otherwise you'll lose the accented characters )
See the attachment.

Google Translate.zip

  • Author

That's also a really good idea!  I didn't come back to read this though until I had already implemented it with the web viewer, but looping a portal instead of a found set.  Then it just uses one instance of IE, and works great.   

 

But yeah, I had forgot about the new Insert from URL step.  I had been using that to upload files into containers in IWP.  I had a script upload them to a temp location on the web server and then had IWP insert the image files into the container.  If I was better at PHP, I'd think I could get a whole custom web page to upload images into containers in one shot.  But Supercontainer is probably just easier...

 

Thanks guys for all the great suggestions!

Thanks, Daniele, you just made my day! Exactly what I needed!

  • 2 weeks later...

Me too, Great insights and this is a keeper for sure. Thanks all of you

While I am at it, does anyone know of any way to play the online translations audio in the webviewer? There are several translation sites that speak the translations but I was wondering if anyone has had those speak using filemaker on the fly. Thanks

  • Author

Does anyone know of a way to get Insert From URL to authenticate to ActiveDirectory?  The standard authentication in the URL doesn't work on our internal sharepoint site 

http://username:[email protected]/

I'm guessing that the site itself controls this, so unless there's another way to make the Script step do authentication, I'll have to continue using a web viewer for this one.

 

Thanks,

 

Dana

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.