Solved

Creating a dynamic file reference as a text field

Posted on 2007-03-23
15
349 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:jarrodprice
Comment Utility
That doesnt work.  I tried.
0
 

Author Comment

by:jarrodprice
Comment Utility
how do I reverse the /\ .

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

Expert Comment

by:lesouef
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:jarrodprice
Comment Utility
Emai_SmtpAddAttachment(Emai_ImportFile(Globals::AttachmentPath);
"attachment"; Emai_GetFileName(Globals::AttachmentPath);
"once"; "" )

This it their example
0
 
LVL 28

Expert Comment

by:lesouef
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
still didnt work.

This should be easier.
0
 
LVL 28

Accepted Solution

by:
lesouef earned 500 total points
Comment Utility
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
Comment Utility
what did you do finally?
0
 

Author Comment

by:jarrodprice
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now