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.

Can't register a function

Featured Replies

Hello,

I don't discover Scriptmaster plugin but I'm disappointed to day. FileMaker 12 ADV and Mavericks on an iMac 27 i5.

I put the pi in the extensions folder ; I opened Scriptmaster.fmp12 file and went on The sendEmail with attachments and ran successfully.  I asked to Register Function by copying to clipboard

RegisterGroovy( "SendEmailWithAttachments( from ; to ; subject ; body ; smtpHost ; attachmentPath )" ; "import javax.mail.*;¶
import javax.mail.internet.*;¶
¶
Properties props = new Properties();¶
props.setProperty(\"mail.smtp.host\", smtpHost);¶
¶
MimeMessage msg = new MimeMessage(Session.getInstance(props));¶
Multipart content = new MimeMultipart();¶
// first the message body¶
MimeBodyPart bodyPart = new MimeBodyPart();¶
bodyPart.setText(body, \"UTF-8\");¶
content.addBodyPart(bodyPart);¶
// then the attachment¶
MimeBodyPart attachmentPart = new MimeBodyPart();¶
attachmentPart.attachFile(attachmentPath);¶
content.addBodyPart(attachmentPart);¶
msg.setContent(content);¶
msg.setSubject(subject);¶
msg.setFrom(new InternetAddress(from));¶
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));¶
Transport.send(msg);¶
return true"; "isGui=false" )

 I opened my fmFile and added in the opening script a line

Set variable  [$sendEmail ; Value : RegisterGroovy( "SendEmailWithAttachments( from ; to ; subject ; body ; smtpHost ; attachmentPath )" ; "import javax.mail.*;¶
import javax.mail.internet.*;¶
¶
Properties props = new Properties();¶
props.setProperty(\"mail.smtp.host\", smtpHost);¶
¶
MimeMessage msg = new MimeMessage(Session.getInstance(props));¶
Multipart content = new MimeMultipart();¶
// first the message body¶
MimeBodyPart bodyPart = new MimeBodyPart();¶
bodyPart.setText(body, \"UTF-8\");¶
content.addBodyPart(bodyPart);¶
// then the attachment¶
MimeBodyPart attachmentPart = new MimeBodyPart();¶
attachmentPart.attachFile(attachmentPath);¶
content.addBodyPart(attachmentPart);¶
msg.setContent(content);¶
msg.setSubject(subject);¶
msg.setFrom(new InternetAddress(from));¶
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));¶
Transport.send(msg);¶
return true"; "isGui=false" )

No error message ; I closed scriptMaster.fmp12 and my file and reopened it : and I have a lot of errors I dont understand (see screencopy)

 

Hope in your help to unblind my eyes !

Noël

Capture d’écran 2016-01-06 à 13.44.18.png

 

Ashamed ! I just found I hadn't load jars....

But now I get the following message :

568d1c5d0ba59_Capturedecran2016-01-06a14

Hope your help ! Thanks

Edited by Noél Dubau
near by the solution....

Hi Noél,

Are you getting the NullPointerException when opening your solution or when you try to use the function? 

Can you send me your logs? Please see this page for log locations. Please be sure to replicate the error before sending without any restarts of FileMaker as this will overwrite the logs. You can send the logs to [email protected] . Once I have those I should have a better idea as to what is going on. 

  • Author

Hello

I'm sorry to have disturb by that question ! I've found my problem : the function required jars and I hadn't load them !

Regards

Noël

How can I mark the question solved ?

Edited by Noél Dubau

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.