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

How do I insert Windows Environment Variables (%USERPROFILE%) as a file path for exports?


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

Recommended Posts

Posted

Hi All,

 

Basically, I'd like to define my export script to just dump a pre-named file onto the user's desktop, regardless of their username.

 

The best way I know of to get directly to a user's desktop would be to use the Windows Environment Variable %USERPROFILE%Desktop . However, FMP doesn't like when I use the Windows environment variable in the file path.

 

I noticed that they have an example for "$Variable", but it looks like that's for Filemaker variables and not Windows environment variables.

 

Is this possible and I'm just getting the syntax wrong? Or is there a different way to do this?

 

 

Thanks

 

Posted

Set as variable

Let ( [
        MAC = "filemac:" & Get ( DesktopPath ) ;
        PC = "filewin:" & Get ( DesktopPath )
] ;
Case(Abs(Get ( SystemPlatform )) = 1; MAC; Abs(Get ( SystemPlatform ))= 2 ;
PC ) &  $$FileName )
  • Like 2
Posted

Thanks. So, I name the variable anything I want, while leaving your "$$FileName" in there? Or am I supposed to rename that to something else?

 

Also, how do I format the export filepath once the variable is defined correctly? Should it look like this?: $VariableName/export.mer

Posted

No, the variable you use in the export dialog needs to contain the full path and file name.  You can not use the export dialog as a calculation.

  • Like 1
Posted

Ah, nevermind, figured out how it all goes. I named the variable "$$ExportPath", changed "$$FileName" to "import.mer" and just formatted the filepath as $$ExportPath.

 

Works a treat! Much thanks!

Posted

You do not need to use global $$variables here - they hang around until you close the file. Use local $variables instead, to have them cleared automatically when the script exits.

  • 1 year later...
Posted

 

Set as variable

Let ( [
        MAC = "filemac:" & Get ( DesktopPath ) ;
        PC = "filewin:" & Get ( DesktopPath )
] ;
Case(Abs(Get ( SystemPlatform )) = 1; MAC; Abs(Get ( SystemPlatform ))= 2 ;
PC ) &  $$FileName )

Thanks! this saved my day.

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