Our Preferred 5 Star Hosting Provider - Award Wining FileMaker Pro Hosting
Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    FilePath Extraction and Manipulation of Referenced Files in Container Fields

    The Scarpetta Group- our preferred FMT Forum Consultants
    Thanks in advance for any suggestions! I am using FileMaker Pro 12 Advanced on Mac 10.7.


    Questions

    1. How do I extract the filepath of a file stored as a reference in a container field? (eg. Internal Hard Drive/Users/Username/Desktop/Hardware Store Receipt.pdf)
    2. What scripting steps are required for a button to rename a referenced file without a name from a calculated field?
    3. What scripting steps are required for a button to move a referenced file?
    4. To the extent that my goals are not possible without plugins (and to the extent that product reviews are welcome in this forum) any suggestions about plugins to consider? I'm aware of options by Troi, Dacons and Productive Computing that address some of my goals, but I'm hopeful that there are features in FM 12 that may prevent the need.


    Goal

    My goal is to have a layout with:

    a container field for a referenced pdf
    a field showing the file path
    a few fields where I enter some custom data, like date, cost, vendor etc.
    a calculated field showing a text string that combines the custom data into a desired filename
    a button that renames the referenced file with the calculated filename
    a button that moves the refernced file to an external hard disk where I am storing referenced files
    Warning: This is an Old Thread
    This discussion is older than 420 days. information contained in it may no longer be current

  2. #2
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Found a typo to Question 2 in my original posting...


    Questions

    2. What scripting steps are required for a button to rename a referenced file with a name from a calculated field?

  3. #3
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    11,567
    Location
    New York and Nassau County, NY, USA
    FileMaker Version
    FM 9, FM 9 Server, FM 10, FM 11, FM 11 Server, FM 12, FM 12 Developer
    OS
    Windows & Mac
    Skill Level
    Developer
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Don't need plugins.

    How do I extract the filepath of a file stored as a reference in a container field? (eg. Internal Hard Drive/Users/Username/Desktop/Hardware Store Receipt.pdf)

    GetAsText (YourTable::YourContainerfield) will output multiple lines of text, something akin to:


    file:Hardware Store Receipt.pdf
    filemac://Internal Hard Drive/Users/Username/Desktop/Hardware Store Receipt.pdf


    Play with one and then use Middle () or GetValue () to snag just the relevant line.


    What scripting steps are required for a button to rename a referenced file without a name from a calculated field?
    do as described above. Then snag the string starting from the 3rd slash (assuming you're on a Mac):

    /Username/Desktop/Hardware Store Receipt.pdf


    (you can do that using Middle () )


    set $ThatPath to that string

    set $NewPath to Middle ($ThatPath, 1, Position ($ThatPath, "/", 1, PatternCount ($ThatPath, "/"))) & "NewFileName.pdf"

    ... and use Perform AppleScript to do it as a shell script like so:


    Perform AppleScript (calculated value


    Let (qmk = """";


    "do shell script " & qmk & "mv $ThatPath $NewPath & qmk

    )



    What scripting steps are required for a button to move a referenced file?
    assign above script to a button. You'll probably want to use g.SomeGlobalTextfield and have it pop up in a custom dialog, "Rename it to WHAT, exactly?" _______ / OK

  4. #4
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Thank you so much for your quick reply. I'm having some problems getting the GetAsText (YourTable::YourContainerfield) to work as you describe as it seems to be returning only the referenced filename, not the filepath. But I am probably overlooking something and will come back to it tomorrow with a fresh pair of eyes. So, thank you for your help and I hope to be in touch again soon.

  5. #5
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    11,567
    Location
    New York and Nassau County, NY, USA
    FileMaker Version
    FM 9, FM 9 Server, FM 10, FM 11, FM 11 Server, FM 12, FM 12 Developer
    OS
    Windows & Mac
    Skill Level
    Developer
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    When it only returns the filename, that implies that it is NOT stored "as a reference" and is instead stored within the FileMaker container field.

  6. #6
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Thanks for the tip about the referenced versus stored files and their influence on filenames versus file paths. You just cleared up several hours worth of frustration. Now for the button scripting...

    I really appreciate your help.

  7. #7
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    I really appreciate you helping me understand how to do this on my own. I'm a bit confused though and any additional help would be much appreciated.

    Following your instructions and continuing with our example, I'm able to get the following:

    Field named "That_Path" to get a calculated result in the form of, as an example, "/Username/Desktop/Hardware Store Receipt.pdf"
    Field named "New_Path" to get a calculated result in the form of, as an example, "
    /Username/Desktop/2012-10-15 $0015.34 Ace Hardware (screwdriver).pdf"

    Questions so far...

    What does the $ sign do? I did some research regarding variables and such but couldn't find anything conclusive. My best guess is that it is the name of my table?

    And then, also following your suggestions, I created an Applescript (which is a first for me!). I set up a button to trigger a calculated Applescript, and I made the command in the script, as you suggested...

    Let (qmk = """"; "do shell script " & qmk & "mv $ThatPath $NewPath & qmk )

    But after testing it, I got a series of errors, and tried various alternatives with no success, and this is where I am stuck.

    1. The first thing was to add a second quotation after the "mv, as the script editor required another quote. I added it after $NewPath". When testing got error:
    "usage: mv [-f | -i | -n ] [-v] source target mv [-f | -i | -n ] [-v] source ... directory"
    2. Left that quote in same place and changed fields. Instead of $ThatPath and $NewPath, I double clicked the fields named that, which added the table name and colons "container_test::That_Path" and "container_Test::New_Path". Got following error:
    "mv: rename container_test::That_Path to container_test::New_Path: No such file or directory"

    Which led me to wonder whether I am including a filepath of adequate length.

    1. Where does the filepath need to begin? At the root hard drive? (eg. Internal Hard Drive/Users/etc.) With the "filemac://"? (eg. filemac://Internal Hard Drive/Users/etc.) Should I revise my ThatPath and NewPath to reflect a larger or smaller path?
    2. Do I need to have already created a folder that is named in the new filepath for there to be an accurate destination?

    My initial question had both a renaming and moving component to it, but regardless of the focus of your help, you're helping me solve my FileMaker frustrations while introducing me to the world of Applescript in a way that I am totally grateful for.

  8. #8
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    11,567
    Location
    New York and Nassau County, NY, USA
    FileMaker Version
    FM 9, FM 9 Server, FM 10, FM 11, FM 11 Server, FM 12, FM 12 Developer
    OS
    Windows & Mac
    Skill Level
    Developer
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    I told you to do this:


    Let (qmk = """"; "do shell script " & qmk & "mv $ThatPath $NewPath & qmk )


    When I should have told you to do THIS instead:


    Let (qmk = """"; "do shell script " & qmk & "mv " & $ThatPath & " " & $NewPath & qmk )


    A variable is a temporarly value; it isn't in any table, it's the equivalent of a snippet of information that you jot down on the back of a napkin: "Here, hang on to this, I'm going to need it in a moment or two".

    Where does the filepath need to begin? At the root hard drive? (eg. Internal Hard Drive/Users/etc.) With the "filemac://"? (eg. filemac://Internal Hard Drive/Users/etc.) Should I revise my ThatPath and NewPath to reflect a larger or smaller path?

    They need to be UNIX paths. No "filemac://". No "Internal Hard Drive". As far as Unix is concerned the name of your startup volume is simply "/".

    Hence /Users/etc not Internal Hard Drive/Users and not "filemac://Internal Hard Drive/Users"

  9. #9
    FREE Member
    Join Date
    Oct 2012
    Posts
    10
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Hi AHunter3,

    I wanted to jump back into this thread to let you know that I'm still here and still grateful for your help. I needed to focus on some other priorities recently but I am eager to get back to this project and look forward to studying your suggestions, hopefully in the next couple of days.

    I also just realized that we corresponded via email on June 18 re. a genealogy project and I wanted to acknowledge the valuable and consistent help you are offering the FileMaker community. I appreciate it.

  10. #10
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    11,567
    Location
    New York and Nassau County, NY, USA
    FileMaker Version
    FM 9, FM 9 Server, FM 10, FM 11, FM 11 Server, FM 12, FM 12 Developer
    OS
    Windows & Mac
    Skill Level
    Developer
    Downloads
    0
    Uploads
    0

    Re: FilePath Extraction and Manipulation of Referenced Files in Container Fields

    Thanks for the feedback!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filepath of file in a container field
    By Jack Rodgers in forum FileMaker Pro 11
    Replies: 2
    Last Post: 11-08-2010, 08:56 AM
  2. Dragging PDF files into Container Fields
    By Andrew Japan in forum FileMaker Pro 8.5
    Replies: 1
    Last Post: 01-22-2009, 07:28 AM
  3. Printing files from container fields.
    By Duce in forum FileMaker Pro 9
    Replies: 3
    Last Post: 04-10-2008, 08:41 AM
  4. Container Fields and PDF Files
    By John Heffernan in forum Calculations and Define Fields
    Replies: 2
    Last Post: 08-01-2003, 08:00 AM
  5. container fields referenced
    By fp in forum Calculations and Define Fields
    Replies: 2
    Last Post: 07-28-2002, 09:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Welcome to the Original FileMaker Forum
With designated forums for almost every FileMaker topic...FileMaker Today is a free-to-join community where you can boost your FileMaker expertise, build better solutions and solve your technical challenges. If you're building FileMaker solutions, this is the place for you.
Follow FMT
We Are FMT
FMT is home of The World's leading FileMaker News Site, Worldwide Developer Directory, FileMaker Connect Community and so much more.