1 2 Previous Next 27 Replies Latest reply on Mar 11, 2012 8:46 AM by philmodjunk

    Auto create a folder

      Title

      Auto create a folder

      Post

      IS it possible for a folder to be automatically created on the mac FM11 advanced?

      PLan is, when  a new record is created in a customers table, a folder is created (using the name field as the folder name).I want to then automatically export invoices etc ad pdfs to this folder..

      I took a look at another post regarding this but got bogged down as it spoke about applescript which i have never used...

      Thank you

        • 1. Re: Auto create a folder
          philmodjunk

          FileMaker cannot, by itself, create new folders. It would be very nice if a new release of the product could list folder contents and create folders as this would enhance the system's ability to manage files created by save as, export field contents and export records. Since it can't you must either use a system script such as Applescript or acquire a FileMaker plug in that provides this capability.

          • 2. Re: Auto create a folder

            I have created a script for FM 11 to autocreate a folder to a mac. The name of the folder is linked to a field - in my case "enquiry name"

            Hope this helps anyone.

            But I need advice on one more thing - How can i export a record as a pdf to this folder? is there a way to calculate an exported file as couldnt find one!

            • 3. Re: Auto create a folder
              philmodjunk

              Here's a link on how to specify a file path and name in a variable for use with Save As PDF that may provide the missing clue: Found Sets to PDF with unique file names

              • 4. Re: Auto create a folder

                Thanks Phil

                I was stuck looking at the one that you helped someone else out with using serial numbers! Doh!!

                • 5. Re: Auto create a folder

                  Hi Phil

                  I have got as far as exporting a pdf and using a field as the name of the pdf. THe problem that i have is I want to export the file to a particular folder that i have already autocreated by using the name of another field!

                  So name of pdf is taken from my customer ID and the name of folder is taken from a calculted field called enquiry name.

                   

                  Any ideas?

                  Thank you

                  • 6. Re: Auto create a folder
                    philmodjunk

                    You should be able to include that information in the calculation that computes the filepath and name. If your new folder is located inside the documents folder, your expression would be:

                    Set Variable [$FilePath ; value: "file:" & Get (DocumentPath ) & Yourtable::enquiry Name & "/" & YourTable::customer ID]

                    • 7. Re: Auto create a folder

                      thanks Phil

                      Will give it a go!

                      • 8. Re: Auto create a folder

                        My file is actually to be exported to a folder called Enquiries which is on my desktop. Have manipluted your script without much success! Could you v kindy fine tune it for me?

                        • 9. Re: Auto create a folder

                          my actual script calculation within the set variable is:

                          ( "file:" & Customers::customers_id & ".PDF")

                           

                          Adapted it like this but it didnt work

                           

                           "file:" & Get (DocumentPath ) & Customers::enquiry Name & "/" & Customers::customes_ID]

                           wasnt sure where to put the full path of the desktop/enquiries/.

                          I tried replacing document path with Get (desktop:enquiriesPath)

                          No luck!

                          • 10. Re: Auto create a folder
                            philmodjunk

                            Use get ( DesktopPath ) instead of Get ( DocumentPath ). Don't forget that you need to append ".PDF" to the end of your file name.

                            • 11. Re: Auto create a folder

                              Hi Phil

                              When I run the script I get this message:

                              “Customers::"customers_id.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.

                               

                              And hos does the Get (doucmentpath ) code tell FM to put the pdf into the folder (customers:enquiry name) that is already in a main folder called "enquirires" which is on the desktop?

                              Thank you

                              • 12. Re: Auto create a folder
                                philmodjunk

                                As as I said in my very first post: No, not just with script steps defined in manage | Scripts. You'd have to either acquire a plug in that can do this or use a system script such as Applescritpt (mac) or a batchfile ( Windows ) to create the folder.

                                • 13. Re: Auto create a folder

                                  Hi Phil

                                  I have embedded some apple script as followes:

                                  --tell application "FileMaker Pro Advanced" set folder_name to cell "Enquiry Name" of current record --end tell set DT to path to desktop tell application "Finder" try make new folder at "Macintosh HD:Users:williamrollo:Desktop:Enquiries:" with properties {name:folder_name} end try end tell

                                   

                                   

                                  This creates a folder neamed by my customers::enquiryname field, and puts this new folder into a folder called enquiries that is located on the desktop.

                                  I want another script to automatically run which will export a record (pdf)from 'enquiry' layout on comitt to the folder that has just been created by using the cutomers::enquiryname field. 

                                   

                                  IS that any clearer - it is rather tricky describing these rather complex scripts especially when Apple script is involved! 

                                  Basically all is working well except the pdf is exported to the desktop as opposed to the folder I have created above, that is located in the enquiries folder, on the desktop..

                                  • 14. Re: Auto create a folder
                                    philmodjunk

                                    Sorry, I think I failed to click the new link added just recently that takes you to the latest post so I didn't read the correct post when replying.

                                    “Customers::"customers_id.PDF”

                                    is an invalid file name on Mac as you can't have colons in  file and folder names. You need to check the syntax of your expression for an error as "Customers::"" shouldn't be part of the file's name. I'd quest that you have quotes where they should be removed for this to work. And probably a \ that should be an /.

                                    I don't own a current OS Mac (have an OLD OS 9 in the closet somewheres) and thus have very little experience with applescripting. You'd need to get an answer from someone more familiar with apple scripts on that question.

                                    1 2 Previous Next