Solved

Creating a dynamic file reference as a text field

Posted on 2007-03-23
15
357 Views
Last Modified: 2012-06-27
I am using an email plug called mailit that can send emails within Filemaker with attachments.   I have created a script that grabs the file reference for the attachment from a global field.  The only way it works is if the file reference is a text field with the reference contained in quotes.

I wanted to change the file reference so that it works on any computer.  I tried changing the contents of the global field to Substitute(Quote(Get( DesktopPath) & "Inventory Update.xls");"/C";"C"), and it didnt work.

I am not sure what to do
0
Comment
Question by:jarrodprice
  • 8
  • 7
15 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 18784005
do you mean to work on pc and mac or just on any PC?
also the plug-in probably need a windows or UNC path, not a fmaker one.
so you should get something like:
"C:\Documents and Settings\Utilisateur\Mes documents\Mes images\mire.png"
and  not
"C:/Documents and Settings/Utilisateur/Mes documents/Mes images/mire.png"
so swap / for \ and it shoud be ok.
Also not that dacons mailit has a browse option to select the file to attach.
0
 

Author Comment

by:jarrodprice
ID: 18784037
I dont want to browse for it, this is an automated script.  This is a pc.  I dont understand your solution.

I want the file reference to be dynamic.  The point of the script is to first import an excel file to the desktop, then send it as an attachment for database backup.  The desktop folder is different on every computer, so I need the file reference to be a Get (desktoppath) calc.  A calc does not work for a file reference.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18784049
it does, but not directly, you must use a variable.
for instance:
set $file = get(...........)
then use $file as the fileref (you type it manually in the fileref dialog window).
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jarrodprice
ID: 18784087
That doesnt work.  I tried.
0
 

Author Comment

by:jarrodprice
ID: 18784117
how do I reverse the /\ .

Substitute does not work to replace "/" with "\"
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18784141
something else is wrong, I do this w/o any pb.
do you have an example from dacons for the attachement path syntax?
do you confirm that the plug-in must grab an external file of which the name is in a fm field?
0
 

Author Comment

by:jarrodprice
ID: 18784154
If the global field it grabs from is a text file reference it works fine.  If it is a variable that is a text reference it is fine.

It only becomes a problem when I introduce a calculation into the mix, either within the global field it is referencing, or as part of the variable.

I know that get(desktoppath) creates the file reference as /C:/ rather then \, so it could be that.  I dont know.
0
 

Author Comment

by:jarrodprice
ID: 18784158
Emai_SmtpAddAttachment(Emai_ImportFile(Globals::AttachmentPath);
"attachment"; Emai_GetFileName(Globals::AttachmentPath);
"once"; "" )

This it their example
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18786416
the resulting path must use \ for sure.
and calc done on the fly should be ok, unless it is wrong
before using the Emai_SmtpAddAttachment function, use a custom dialog to display the same expression and check if it looks OK.
also quote function prevents get(desktoppath) from working. so remove that 1st
0
 

Author Comment

by:jarrodprice
ID: 18786744
I am confused.  how do I switch the direction of the "\"'s

I tried evaluating the calc "get(desktop)path"

this is the result: "/C:/Documents and Settings/Administrator/Desktop/"

So how do I switch it around?

Substitute (get(desktoppath);"/";"\") does not work

I would guess this is the cause of the problem, so how do I switch them?

0
 
LVL 28

Expert Comment

by:lesouef
ID: 18787875
should be:
if you need quotes:
"\"" & right(substitute(get(desktoppath);"/" ; "\\" ); length(get(desktoppath))-1)& "\""
if you don't:
right(substitute(get(desktoppath);"/" ; "\\" ); length(get(desktoppath))-1)

ie, substitute the /, then skip the first character
0
 

Author Comment

by:jarrodprice
ID: 18803421
still didnt work.

This should be easier.
0
 
LVL 28

Accepted Solution

by:
lesouef earned 500 total points
ID: 18804855
try to import the file to be attached in a container and use the other method, the one for files from a container field.
And their example works...
So must some other thing... some spécial character in your file name??
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18854990
what did you do finally?
0
 

Author Comment

by:jarrodprice
ID: 18857358
The first step I imported the file into a container, then used their instructions for sending attachments from a container.

That way, I was able to use the Get (Desktoppath) when importing it into the container, without involving the plugin.

After that it worked fine
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Primary 1 94
Printing Portal records 7 181
Filemaker 14 vs Delphi Embarcadero 7 223
sending mail from filemaker pro 10 5 57
Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question