Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5402 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I am trying for a script but feeling difficult to make it.

1) It should first copy the file into the container.

2) It should make the directory and copy the file into the directory.

3) Directory name should be as Company name + Fund Name.

4) Filename should be as FundName+sequence no.

I tried by myself and using Mooplug plugin but it shows error.

Hoping a kind reply.

Regards,

Tusif

script1.jpg

Posted

Because I am thinking for sub folder, It would be "//" two slashes.

I as doing something wrong? Actually It is creating folder but it is not copying file in it... Do you know why?

  • 4 weeks later...
Posted

probably "D:" backslahes are escape sequences so to escape a escape you must add a

and the part where it adds the file and exports it back should be after the If / End If and no Else

just check if path exists, if no create it end if

add the file

and Get(ActiveFieldContents) is wrong use a proper field or variable for your filename

  • 2 weeks later...
Posted

I think the backslashes may be correct; they are producing a single ( if that's what you want).

I agree the End If should be after the "create folder", with no Else. I also agree to just use the name in the container field directly; I'd use GetAsText (container) to be explicit. This will only work if you embed the file (not as Reference).

Whereas really it would make more sense to Insert [ reference ]. You do not really want or need to BOTH embed the file, and move the real file, do you? That creates a confusing situation for people editing the file later, as the "real" file now exists in 2 places. Maybe yo do, I don't know; but something to be aware of.

GetAsText (container) will return 3 lines if you Insert [ reference ] (2 lines if from a mounted volume). The last line will be the FileMaker syntax full path to the file. The file name will be after the last slash; requires some text parsing, but not difficult. If my container is "Path::file_con" and the file was inserted as reference:

Let ( [

txt = GetAsText ( Path::file_con);

p_full = GetValue ( txt; ValueCount (txt) );

len = Length ( p_full);

pos = Position ( p_full ; "/" ; len ; -1 )

];

Right ( p_full; len - pos )

)

I think the biggest problem to the Export Field Contents is that you're asking FileMaker to Export Field Contents, but the path you're giving it is an OS syntax path (Windows in this case). It needs to be a FileMaker syntax path for a FileMaker command; which would require a prefix of "filewin:/" or "filemac:/", depending on the OS of the client computer.

Case ( Abs ( Get (SystemPlatform)) = 1; "filemac:/", "filewin:/" )

[ slash only needed if the file path you pass does not already have one; often they do ]

You would then need the "server" name, which would also be different for Windows ("D:/") or Mac ("its name").

You could see what the whole path should look like by inserting a file from your server into a container field as reference from a client on each OS.

This topic is 5402 days old. Please don't post here. Open a new topic instead.

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.