You can use Open URL to open the file, I believe...
Dear Phil, (philmodjunk)Thank you for your quick reply. I tried to use the Open URL script step with no success. I must have the wrong syntax.Script:"Open URL (No dialog; Open with url::Get File"whereas Get file is a global calculation "file://desktop:/" & Nameand Name is a global calculation "My File" (a TextEdit file).Thank you for your patience.David Summer
That doesn't look like a valid file path to me.
Here's an expression that worked for me:
"file:" & Get ( DesktopPath ) & "CheckboxWScrollBar.fp7"
The file name in quotes was located on my desktop.
So I tried your example script using my data and the result was "Safari can't find the server".
Here's my script (that doesn't work):
Open with url::Get File
Get File is a global calculation field defined as: "file:" & Get ( DesktopPath ) & Name
In the browse mode: Get File shows up as: file:/Macintosh HD/Users/david/Desktop/My File
Name: is a global text field defined as: My File (a TextEdit file)
Where have I gone wrong?
Get File is a field name? WHere's the name of the table?
You should see: Open URL [TableName::Get File]
You don't by any chance have:
Open URl ["Get File"]
Uh oh! My table name is: Open with Url
An unfortunate table name choice for my sample script but it shouldn't matter... or does it?
It's the only table in my sample data base. Once I get a working script, I intend to modify and use it in my real data base.
But to answer your question directly, yes Get File is a calculation text field whose value is defined as:
"file:" & Get ( DesktopPath ) & Name
Name is a calculation text field whose value is: My File (a TextEdit file on my desktop)
The trouble is that the function as suggested by Phil only works well on windows and not on MacOSX and the alternative could be using "send event", but that does not work either because one has to assign an application to send the event to and assigning it to Filemaker Pro is not allowed. The only option i can get working is to use "Perform AppleScript":
before you can do that you must first determine the (unix)username and put it in a variable:
$username = Let([LST=Trim( Substitute( Get( DesktopPath ) ; "/" ; ¶ ) );NR=ValueCount( LST ) -1 ];Substitute ( MiddleValues ( LST ; NR ; 1 ) ; [ ¶ ; "" ] ) )
then write the script:
$script = "tell application \"Finder\"¶activate¶open document file \"" & $filename & "\" of folder \"Desktop\" of folder \"" & $username & "\" of folder \"Users\" of startup disk¶end tell"
(where $filename is the variable with your copied file)
now enter $script in the dialog for "calculated script" in the "Perform AppleScript" scriptstep and it should work fine
@phil: imho should filemaker inc make it possible to either use the "send event" step to send an event to "self" or apple should make it possible to send a URL to fmp7:// or to file: as is possible on Windows. The tools offered on windows are in this particular issue much eassier than on macosx
I don't mean to hijack a thread, but have been trying something similar and having the same issue.
@menno - if you wanted to use a path to the server, could you use something like "volumes/server/$filename" rather than trying to get the desktop path of each computer. Then use a Case function to detect whether the user is on a Mac or windows machine to determine which method to use.
@Menno, thanks for the additional info. As I do not currently have a mac system to use, only windows, I was unaware of this difference. I agree that this lack on the Mac side of the fence is unfortunate and leaves room for improvement. However, I'm just a fellow fileMaker user, not a FileMaker Inc representative. You might want to post this comment in feedback or use the Feature Suggestion Form if you have not already done so. (And if you are reading this and agree with Menno, you can click this same link and "chime in". )