Jump to content

Recommended Posts

Posted (edited)

I have a script that generates a PDF from a set of criteria in a record and attaches it to an email using Apple Mail.  On my Machine, a Mac Studio M1 Ultra, running FMP 19, on 12.7.1 and using Apple Mail 16, this works just fine.  

On another office machine, a iMac M1  also running 12.7.1, and FMP 19 and Apple Mail 16, when I press the button to trigger the script, the layout just sort of blinks and nothing happens.

The only obvious difference is that the iMac is sharing the database that the script is part of (Mac Studio is the host)  Before I upgraded to the MS, this behaviour still happened on my old machine, a 2018 Mac Mini, the other machine was the same.  

Is it possible that the iMac is trying to access MY version of mail, and not the one that on the iMac.

So to recap, all software between the Machines, is identical and the DB is hosted on the Mac Studio.  It works on the Mac Studio and not the iMac.

Is there some really obvious reason that this would not work and I am just not aware?

Cheers

 

Craig

 

PS, I realise that when I trigger the script on the iMac, it does actually bring Apple Mail to the foreground, but it does not create the email or the attachment.  

Edited by Craig_ST
Posted

I have been looking into this and feel that in might be to do with the file path that the PDF is saved to and the iMac either not having permissions to save to this on the host or it can not save over the network and should be saved locally.  I just don't know how to change that only on the iMac.  

Currently the out put file path is listed as $filePath.  If I add filemac:/volumeName/directory/filename below that (with correct info for the iMac) would this work, and if so, what is the filename meant to be?

 

image.png.0e592b45fec5a983991d1f09bef0c94b.png

Posted

I don't think anyone will be able to help you without seeing the actual script.

Before you do that, please make an effort to pinpoint the problem by using the script debugger. 


I am also troubled by your description:

2 hours ago, Craig_ST said:

the iMac is sharing the database that the script is part of (Mac Studio is the host)

Are you talking about dedicated peer-to-peer sharing as described here?
https://help.claris.com/en/pro-help/content/peer-to-peer-sharing.html

Or are you just sharing the file using your LAN (which you should most definitely not do)?

 

Posted (edited)

First off, why use the mailing app, when you can send headless from inside filemaker, you can always put yourself in the BCC line?

Secondly, for storing pdf's use something like: 

Skærmbillede 2024-05-21 kl. 14.50.00.png

But if you use say your desktop as temporary location for the pdf, your'e working with - should some housekeeping be done, here's how with a tip, from: https://databasepros.com/list.php?resource_id=DBPros000819 - the script goes like: 

Skrmbillede2024-05-21kl_14_58_04.thumb.png.bacb9648dd6380a0840a5bab6e03d215.png 

--sd

Edited by Søren Dyhr
Posted
18 hours ago, comment said:

I don't think anyone will be able to help you without seeing the actual script.

Before you do that, please make an effort to pinpoint the problem by using the script debugger. 

I have used the script debugger, but can not see anything or even certain if I am doing it right.

18 hours ago, comment said:


I am also troubled by your description:

Are you talking about dedicated peer-to-peer sharing as described here?
https://help.claris.com/en/pro-help/content/peer-to-peer-sharing.html

Yes I am doing as described in the above link. 

Given that it works properly on my Mac Studio, and not on the other machine, I feel it must be related to how the script is saving the PDF or is meant to, and it can't do that because something in the script is telling it to do so on my machine and it can not access this for what ever reason. 

 

I would attach the script, but for the life of me can not figure out how to even copy and paste the ******* thing. 

Any help appreciated,

 

Craig

 

 

13 hours ago, Søren Dyhr said:

First off, why use the mailing app, when you can send headless from inside filemaker, you can always put yourself in the BCC line?

Largely because I don't know how that is done, or that it could be.  But also, while I have a set email defined that recipients receive, the nature of our business means that often the boilerplate text in the email will need to be modified for the specific recipient, so it is useful to have it pop up in my local email client and be able to make an alteration if needed and then send, or just send if not. 

 

13 hours ago, Søren Dyhr said:

Secondly, for storing pdf's use something like: 

Skærmbillede 2024-05-21 kl. 14.50.00.png

But if you use say your desktop as temporary location for the pdf, your'e working with - should some housekeeping be done, here's how with a tip, from: https://databasepros.com/list.php?resource_id=DBPros000819 - the script goes like: 

 

 

 To be honest, I have no idea where the PDF file is saved or if it even is.  I run the script and the PDF appears in the body of the email, and I send it - if they are saved somewhere else prior to that, I really don't know.   As you may be suspecting by this point, I am not a filmmaker expert 🤪 I use it because I need to, so do appreciate any help - just type really slowly... 

13 hours ago, Søren Dyhr said:

Skrmbillede2024-05-21kl_14_58_04.thumb.png.bacb9648dd6380a0840a5bab6e03d215.png 

--sd

 

Posted
3 hours ago, Craig_ST said:

I would attach the script, but for the life of me can not figure out how to even copy and paste the ******* thing. 

File > Print… > PDF > Open in Preview

Copy from there.

 

Posted (edited)
23 minutes ago, comment said:

File > Print… > PDF > Open in Preview

Copy from there.

 

Thanks for that, would not have figured that out.  Here it is.  

EDIT actually it has not included the last lines, that are where the sending by email actually happens 

🙂

 

Set Variable [ $fileName; Value:"BlissStudioPhotoOffer_" & Trim(DealOffered::DealYear) & ".pdf" ]

Set Variable [ $filepath; Value:Get(TemporaryPath) & $fileName ]

Set Variable [ $Contactemail; Value:ContactDetails::ContactEmail ]
Set Variable [ $ContactFirstName; Value:ContactDetails::ContactFirstName ]
Set Variable [ $subjectline; Value:ContactDetails::_pkSchoolName/*Table::School Name*/ ]

If [ IsEmpty ( DealOffered::Options Offered ) ]
Show Custom Dialog [ Title: "Choose Option"; Message: "You must choose a value in the OPTIONS OFFERED field";

Default Button: “OK”, Commit: “Yes” ] Exit Script [ ]

End If
If 
[ DealOffered::Options Offered = "Buy Out" and DealOffered::FreePrintOffered = "No" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter Deal Buyout NO FREE PRINT” (DealOffered) ] [ Show only related records ]

Else If [ DealOffered::Options Offered = "Buy Out" and DealOffered::FreePrintOffered = "Yes" ]
Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter Deal Buyout” (DealOffered) ]

[ Show only related records ]
Else If [ DealOffered::Options Offered = "Print" and DealOffered::FreePrintOffered = "Yes" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter Deal Print” (DealOffered) ] [ Show only related records ]

Else If [ DealOffered::Options Offered = "Print" and DealOffered::FreePrintOffered = "No" ]
Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter Deal Print NO FREE PRINT” (DealOffered) ]

[ Show only related records ]
Else If [ DealOffered::Options Offered = "Gen NDBO" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Gen NDBO” (DealOffered) ] [ Show only related records ]

Else If [ DealOffered::Options Offered = "Gen DBO" ]
Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Gen DBO” (DealOffered) ]

[ Show only related records ]
Else If [ DealOffered::Options Offered = "Gen Grad" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Gen Grad” (DealOffered) ] [ Show only related records ]

Else If [ DealOffered::Options Offered = "Introductory < 150 kids" ]
Go to Related Record [ From table: “DealOffered”; Using layout: “Mail Drop” (DealOffered) ]

[ Show only related records ]
Else If [ DealOffered::Options Offered = "Buy Out No Print" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter Deal Buyout No Print Offer” (DealOffered) ] [ Show only related records ]

Else If [ DealOffered::Options Offered = "Opt 1 & 2 Alt PB costs 2025" ]
Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter OPT 1 & 2 YES FREE PRINT - DBO PB = $$

2025” (DealOffered) ]
Else If [ DealOffered::Options Offered = "PDF Letter ATTENDANCE FEE" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF Letter ATTENDANCE FEE” (DealOffered) ] Else If [ DealOffered::Options Offered = "Set Cost Buy Out" ]

Go to Related Record [ From table: “DealOffered”; Using layout: “PDF SET FEE BUY OUT 2025” (DealOffered) ] End If

Save Records as PDF [ File Name: “$filePath” OR “$Vairable”; Create folders:No; Current record ]

 

Ok, so it seems determined to not let me copy or print/copy paste that bit so here is a screen grab

Screen Shot 2024-05-22 at 2.01.16 pm.png

Edited by Craig_ST
Posted (edited)

I do not notice anything out of the ordinary in your script.
 

What happens on the client machine if the script is just a single step:

Send Mail [ Send via E-mail Client; With dialog: On; To: "[email protected]"; Subject: "Test"; Message: "Testing." ]

with no attachment?


And another point that needs clarifying: 
Does the privilege set on the client machine allow printing?

 

 

Edited by comment
Posted (edited)
2 hours ago, Craig_ST said:

Set Variable [ $subjectline; Value:ContactDetails::_pkSchoolName/*Table::School Name*/ ]

Well here is at least one, I would suggest that you every time you fire a GTRR(FS) checks if you have arrived as expected ... Then is all the layouts seemingly the same table occurrence group, then would a single GTRR(FS) suffice, and  then use a calculation as to which layout to land in:

Skærmbillede 2024-05-22 kl. 08.37.27.png

Say you have one layout to use, when just one record is in the found set - and then yet another when there is two to display, and finally a third layout for showing multiple records. You could use following script to address these 3 cases, this way:

Skærmbillede 2024-05-22 kl. 10.01.56.png

--sd

Edited by Søren Dyhr
Posted
5 hours ago, Craig_ST said:

email will need to be modified for the specific recipient

But isn't that much better not to involve the mail app?, yet another option is to use the MBS plugin to generate HTML mails instead of pushing into Mailchips API ... I'm fully aware that mails today requires a professional look, and oldfasion pushing mails though a mail app not always are up to such standards.

--sd 

Posted
41 minutes ago, Søren Dyhr said:

But isn't that much better not to involve the mail app?, yet another option is to use the MBS plugin to generate HTML mails instead of pushing into Mailchips API ... I'm fully aware that mails today requires a professional look, and oldfasion pushing mails though a mail app not always are up to such standards.

--sd 

Hi Søren, 

I imagine that there are other better ways to do this, but it is well above my ability.  I am happy using Apple Mail to send the emails and it does work, just not on my other Machine. (we do not use MailChimp or any other system like that)   Our requirements are very minimal and I only need this function for about 3 months of the year when we are making a push to rebook clients or book new ones. 

 

I appreciate your time and effort, 

 

Cheers

Craig

 

Posted (edited)

Ok if no fancy shenanigans is required, then should you turn to SMPT instead of using the mail app - did you by the way try what Michael suggested to eliminate the pdf attachment from the debugging? 
 

Another of Michael’s questions were if it was peer2peer or/and perhaps webdirect? The last part is my addition, but if it is, is it another kettle of fish, which only can be pulled off in a PSOS environment, and only like SMPT, because you would not know what is available at server side of the matter?

If peer2peer is the case her, would funny problem arise if the FileMaker solution is shared by os-level sharing and not the protocol’ed way its supposed to?

—sd

Edited by Søren Dyhr
Posted (edited)

Hi Søren,

I am sharing this database to the iMac by having my Mac Studio host it and accessing it through the host menu on the iMac.  I believe this is the correct way to do it. 

I have not yet had the chance to test the solution that Michael suggested as the other machine has been in use needing to use the database, I should have the opportunity to do so today though. 

If using SMTP, will I have the opportunity to make client specific alterations to the the email before it is sent, as this is a must for us. 

Craig

Edited by Craig_ST
Posted
2 hours ago, Craig_ST said:

I am sharing this database to the iMac by having my Mac Studio host it and accessing it through the host menu on the iMac.

That could be read both ways, one of which is correct and the other is inviting disaster.

Make sure you are using Filemaker to share the file on the host machine, not the OS. And that you are opening the file through the File > Hosts menu in Filemaker on the client machine as explained here: https://help.claris.com/en/pro-help/content/opening-files-as-client.html.

 

Posted
4 minutes ago, comment said:

That could be read both ways, one of which is correct and the other is inviting disaster.

Make sure you are using Filemaker to share the file on the host machine, not the OS. And that you are opening the file through the File > Hosts menu in Filemaker on the client machine as explained here: https://help.claris.com/en/pro-help/content/opening-files-as-client.html.

 

Sorry, yes, I knew what I meant. 🤪  I open the file in Filemaker on the Mac Studio and then from the iMac, I go to File > Host and open the database from there within Filemaker

Posted (edited)
3 hours ago, Craig_ST said:

If using SMTP, will I have the opportunity to make client specific alterations to the the email before it is sent, as this is a must for us. 

Yes it's a calc field: 

Skærmbillede 2024-05-23 kl. 07.56.11.png

...heres what I've done at some time, down in the button saying $where ...am I attaching the pdf. Although font size and color won't work as expected - if's too limiting then go the plugin way of doing this!

--sd

Edited by Søren Dyhr

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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