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

Selecting Windows Folders for Import/Export


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

Recommended Posts

Posted

Hello,

I am working with the import/export feature in a script. I can easily setup the script to send to what most people would think as a common place to save any backup, excel, or HTML and that is drive 'C'. What I am finding is that there are a few people out there that don't have their main hard drive as drive 'C'.

Questions:

1. How can you setup an import or export to save in a persons 'my documents' folder? I know I could select the folder, but everyones 'my documents' folder has their name associated with it. Is there a way in FM to get around this. As far as I can tell you can send to a specific folder or the parent FM folder. I would like to send the info their 'my documents' folder.

2. I also have HTML reports that are pulling from parent and child records and when I send them to XML and produce an HTML report it will list the field names with the 'table::fieldname' format of the portal fields. Is there any way around this so that it will only list the field name. It works great when sending to Excel, but XML to HTML does this and it is annoying.

Man, there is so much that the help files just don't tell you.

Thanks for your help on this.

Posted

Hi, Brewser. The only way i can think of to do #1 (without using a plug-in) is to prompt the user to navigate to My Documents to save the export. However, if you have a plug-in available to you such as the Troi File plug-in, you could do this:

1. In a FM script, use the "Send Command" step to send the command-line:

SET >> C:FMVAR.TXT

This creates a file on the C root called FMVAR.TXT. The contents of this file are the Windows environmental variables.

2. (This is the part that requires a plug-in) Read the contents of FMVAR.txt into a field in Filemaker.

3. Parse out of that field the value of the line that begins with "USERNAME=" (without the quotes. You could do this with a script consisting of the following lines:

Set Field ( thisField , Middle ( thisField , Position ( thisField , "USERNAME=" , 1 , 1 ) + 9 , 10000 ) )

Set Field ( thisField , Left ( thisField , Position ( thisField , " :paragraph:" , 1 , 1 ) - 1 ) )

Now the contents of thisField are equal to the user name from the Windows login.

4. Set Field ( thisField , "C:Documents and Settings" & thisField & "My DocumentsnameOfTheFile.???" )

where you have substituted the name and extension you want for the file right at the end.

5. Export data to C:tempnameOfTheFile.:.

6. (Again, this part requires the plug-in) Using the TrFile-Copy command, copy the file from C:temp to the directory now specified in the field thisField.

You may find all this perhaps a bit obscure. If this is a function that you really need, and nobody posts a solution here that does not require a plug-in, i would recommend you go ahead and buy the plug-in and i'll send you an example of how to implement what i described above.

Man, there is so much that the help files just don't tell you.

I know! Frustrating, isn't it?

Jerry

Posted

Where i wrote " : paragraph:" in the second line of code above, i meant the paragraph symbol. I guess because it's within a [ code] element it doesn't show up as the symbol.

Posted

Thanks Quin,

The problem is the person may not have a drive 'c'. There is one user that his CD Rom drive is drive 'C'. So I can't designate to export to drive 'c'. I know everyone has a my documents folder. I was hoping there was something built in such as the relative path to save to the my documents folder.

It doesn't sound that way.

Thanks again,

Brad

Posted

Hi Brad, that's quite unusual to not run programs from the C: drive. I've never worked with that before, but inspecting the results of the SET command, it looks like there is a variable produced named HOMEDRIVE. On my system its value is C: ; i would hazard a guess that on your one user's system its value would be D: .

Now that i look at it further, there is also a HOMEPATH variable (which, on my system, is the next variable). So i guess what you could do is just parse those two out, add "My Documentsfilename.123" to that, and you'd have a file name to copy to.

J

This topic is 7376 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.