if my memory serves me well...
"filewin:" or "filemac" then
get(desktoppath) & filename & fileextension
should be enough for both platforms
Well I tried: "filemac:" & Get ( DesktopPath ) & "Import/Export_patient.fmp12"
when setting the variable that goes into the Import line, but still no files found.
if "Import/Export_patient.fmp12" is the file name, this could be a problem since the "/" will be considered a directory separator.
Almost right. You have to use the filemac/filewin prefix for export, but for importing you have to use imagemac/imagewin.
I regularly do this when creating quotes. I export the quote letter as a pdf so it can be emailed to my client, but then store that pdf in the quote record for future reference. To facilitate this I save both versions of the filepath as variables, then export using one and import using the other.
PeterWindle: I've put a test file inside the Import folder and get this filepath:
file:/Macintosh HD/Users/stephen/Desktop/Import/Tester file.fmp12
so it's a puzzle as to why it doesn't work with: "filemac:" & Get ( DesktopPath ) & "Import/Export_patient.fmp12"
Keywords: To no avail I tried: "imagemac:" & Get ( DesktopPath ) & "Import/Export_patient.fmp12"
Still get told there are no files inside the Import folder.
You don't import Filemaker files. You import RECORDS from Filemaker files.
My syntax error. I meant there were no files in the folder from which to import records.
If you have a Folder on your desktop called "Import" and inside that folder you have a file called test.fmp12" then the following script will work:
Set Variable [ $var ; Value: Get(DesktopPath) & "Import/test.fmp12" ]
Import Records [ With dialog: Off ; “$var” ; Add; Mac Roman ]
That's where I started from but it doesn't work. Since the file is where it's meant to be and contains the correct record, what else could I look at to detect the error?
BTW, using the suggested simple script in isolation shows that the file can't be found, but if I follow the browser prompt and specify the file, it is correctly imported, so it does still point to an incorrect filepath.
Another possibility is a permissions issue. As you are trying to access the file location by script you will need to make sure you have read/write permissions properly set for fmuser (I think that's the term). This might explain why the files are clearly present and visible when you locate them manually, but not when you try to locate them via a script.
Not having access to a file in a folder on the desktop looks improbable...
I agree, but if it were me I'd still want to eliminate that as a possible cause.
I suppose you already have a folder "Import" on your desktop.
I enclose a file (which btw demonstrates that when you need 100'000+ random records there's a better way to create them from nothing than looping 100'000 times on new record).
I modified it so that it will use your Import folder on the desktop to work towards its goal.
Please open it and click the leftmost button. If it works, then your Import folder is ok but maybe your file is not.
V. good point, but in this case the script has full access privileges.
I used a test file to grab the filepath and changed the 'generic' variable path to:
"file:" & Get(DesktopPath) & "Import/"
then to get a specific file used a 2nd variable to add the filename to the above path using '& "filename"
I need to do more tests, but the above worked.
Does anyone know whether Windows will need any variation to this? And thank you for all the suggestions.