Jump to content
radius360

Open and edit files in container

Recommended Posts

radius360

Hoping someone can help! I've searched Google and the forums and haven't quite found the answer I need. In my mind it should be a simple one but it never seems to work out that way. lol. Anyway, to put it simply, I'd like to drop an Adobe Illustrator file into a container and have the ability to open, edit, close the file and have these changes reflected in the container's contents eliminating the need to bounce back and forth between OSX folders and Filemaker. 

I've seen some info about using "Open URL..." but my attempts to use this have only resulted in a Safari browser window opening with an error message. I'm assuming I'm missing some link that sends it to the required application?

Thanks!

Pete 

Share this post


Link to post
Share on other sites
AHunter3

To use Open URL to open a file stored in a container field, you utilize a two-step operation:

 

1) Export the file to a specified location.  Assuming you're intending to use Adobe Illustrator to edit the file, I'm also assuming that means you're using a conventional workstation OS (Mac or Windows) in which case you can export to DesktopPath, DocumentsPath, or TemporaryPath, as in this example:

 

Set Variable [$FilePath; Get (TemporaryPath)&"FileName.ai"]

Export Field Contents [no dialog; YourTable::YourContainerField; $FilePath]

 

2) Then, having done so, you execute a file URL to open the file.  File URLs utilize the classic Unix notion of a file's location, which is slightly different from the native FileMaker notion, so you'll need to modify $FilePath somewhat.  Let's say $FilePath is "filemac:/Macintosh HD/private/var/folders/fk/ishmakabibble/Cleanup At Startup/XYZ/FileName.ai" — the outcome of exporting it into the TemporaryPath folder; the Unix path for the file URL doesn't include the name of the startup hard drive, it instead designates the startup hard drive with a single slash; you'd just want "//private/var/folders/fk/ishmakabibble/Cleanup At Startup/XYZ/FileName.ai".  And then the prefix is not merely "file:" but "file://" so the full value of the file URL is going to look like this:

 

"file:///private/var/folders/fk/ishmakabibble/Cleanup At Startup/XYZ/FileName.ai"

 

 

so...

 

Set Variable [$OpenFileURL; "file://" & Middle ($FilePath; Position ($FilePath; "/"; 1; 2); Length ($FilePath) )]

Comment [That strips off the name of the startup hard drive by starting the string at the slash that follows the drive's name in the original $FilePath]

Open URL [no dialog; $OpenFileURL]

 

note:

 

It's a bit different if you're opening a file exported to a different hard drive.  If the path to which you exported the Illustrator file was not on the startup hard drive, you'd have to specify it not merely with the drive name, but preface it with "volumes/" — "/volumes/External HD/Work/FileName.ai" or something like that.  FileMaker would have something like this in $FilePath:

 

"filemac:/External HD/Work/FileName.ai"

to convert it to this,

"file://volumes/External HD/Work/FileName.ai"

you'd use...

Set Variable [$OpenFileURL; "file://volumes" & Middle ($FilePath; Position ($FilePath; "/"; 1; 1); Length ($FilePath) )]

 

 

 

 

 

Share this post


Link to post
Share on other sites
radius360

Correct me if I'm wrong but I believe this would result in a new file being created in an OSX folder. But not automatically saved back to the container from where it originated? In other words would I still need to drag the newly saved AI file back to the FM container? Its sounding like what I want isn't possible. Or at the very least, way beyond the scope of my capabilities! But this definitely gives me ideas for something else I'm working on so I do appreciate the thorough reply!

Share this post


Link to post
Share on other sites
AHunter3

Well, you know the path to which you just exported the file.  After editing, you click a button that reinserts the same file into the same container -- no dragging involved.  

 

Set Variable [$FilePath; Get (TemporaryPath)&"FileName.ai"]

Insert File [no dialog, YourTable::YourContainerField; $FilePath]

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

×