Jump to content
Karlos Fandango

Get (FilePath) not working

Recommended Posts

Hi, I wonder if anyone can help. I have a folder on my desktop called “quotes” and have a working script that saves quotes in a PDF format to that folder.

1). This works just fine…

Get ( DesktopPath )  & "/" & "quotes" & "/" &  Quotes::Quote_Pk & "-Quote.pdf"

2). But can anyone tell me why this doesn’t…

Get ( FilePath )  & "/" & "quotes" & "/" &  Quotes::Quote_Pk & "-Quote.pdf”

…using the second I get the following error message…

Quote

“Q-00272-Quote.pdf” could not be created on this disk.  Use a different name, make more room on the disk, unlock it or use a different disk.

I need the second script to work because we have had to move the database as well as the "quotes” folder, to another location.

Any help would be greatly appreciated.

Karlos.

 

Share this post


Link to post
Share on other sites

The Get ( FilePath ) function returns the full path to your solution file - including the filename. It makes no sense to append a "/" to the result.

If you want to calculate a path relative to your solution file, you must start by removing the filename from the path returned by Get ( FilePath ). For example, if the folder named "quotes" is in the same folder as your solution file, the following should work as the path for the saved PDF file:
 

Let ( [
path = Get ( FilePath ) ;
pos = Position ( path ; "/" ; Length ( path ) ; - 1 ) ;
dir = Left ( path ; pos )
] ;
dir & "quotes/" & Quotes::Quote_Pk &"-Quote.pdf”
)

 

Share this post


Link to post
Share on other sites

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

×

Important Information

By using this site, you agree to our Terms of Use.