8 Replies Latest reply on Mar 16, 2009 5:01 PM by philmodjunk

    Creat a folder on Window desktop and name it after a field

    Bandit881

      Title

      Creat a folder on Window desktop and name it after a field

      Post

      Hi,

      I would like to creat a script so every time i creat a new record a folder is also created on my desktop, I would like for that folder to be named after one of the fields results. Then I would like for filemaker to save the desktop address of that folder in another field so I can use open URL to open that folder in the future.

      Can anyone help please?

      Thank You

        • 1. Re: Creat a folder on Window desktop and name it after a field
          Jens Teich
             > on Window desktop

          On Windows (or Mac)?

          Jens

          • 2. Re: Creat a folder on Window desktop and name it after a field
            Bandit881
              

            This is on windows xp. I'm using filemaker 8 now but I just got filemaker 10

            • 3. Re: Creat a folder on Window desktop and name it after a field
              Jens Teich
                 The basic technique works like this: if you have a field with content
              Set fso = CreateObject("Scripting.FileSystemObject" )
              Set folder = fso.CreateFolder("c:\Temp\test" )
              and export this field to a text file with box 'execute' checked then a new folder will be created.

              The fields content can be produced by a calculation so that you can vary the name of the folder.

              Jens

              • 4. Re: Creat a folder on Window desktop and name it after a field
                EBickmann
                  

                How would one do this on a Mac? and can I use multiple fields to create a layered series of folders... ie

                 

                for fields (field 1) (field 2) (field 3)

                 

                Folder (field 1) with a sub Folder (field 2) with a sub Folder (field 3) 

                • 5. Re: Creat a folder on Window desktop and name it after a field
                  Contour
                    

                  jensteich wrote:
                  The basic technique works like this: if you have a field with content
                  Set fso = CreateObject("Scripting.FileSystemObject" )
                  Set folder = fso.CreateFolder("c:\Temp\test" )
                  and export this field to a text file ...

                   

                  jensteich, for those of us that don't recognize the scripting language, can you identify it and possibly point us to a language guide of some sort.  Is it Visual Basic?

                   

                  It looks like a very powerful technique for extending FileMaker's capabilities.  I'm surprised I haven't seen it mentioned elsewhere.  Do you know of any other examples of use?

                   

                  Thanks in advance for any help.

                   

                   


                  • 6. Re: Creat a folder on Window desktop and name it after a field
                    FentonJones
                      

                    On a Mac you could run AppleScript with FileMaker, using the Perform AppleScript script step. Then you would run a Unix command with AppleScript, using: do shell script "the unix command"

                     

                    In this case the command is "dir", with the "-p" option, which will create a hierarchy of folders. It can also do sibling folders, using brackets "{a,b,c}" 

                     

                    AppleScript to create a hierarchy on your desktop, with comments:

                     

                    set desktopPath to POSIX path of (path to desktop)

                    setmkdirStrto "mkdir -p " & quoted formof (desktopPath & "a/b/c/d/e/")

                    -- "mkdir -p '/Users/username/Desktop/a/b/c/d/e/'"

                    -- quoted form is only needed if there are spaces in the names, but doesn't hurt

                    do shell script mkdirStr

                     

                    [P.S. That's supposed to be a close parenthesis, not a "winky" at the end of the sentence.] 

                    • 7. Re: Creat a folder on Window desktop and name it after a field
                      FentonJones
                        

                      Quoting the whole thing works fine with the example posted, of simple hierarchal folders. But if you use brackets, to create "sibling" folders, then quoting the whole thing stops it working. In that case you need to quote the individual folder names with spaces, then put them together before running the command:

                       

                      set desktopPath to POSIX path of (path to desktop) 

                      set a to quoted form of "my folders"

                      set b to quoted form of "donut soup"

                      set c to quoted form of "dog bone"

                       

                      setmkdirStrto "mkdir -p " & desktopPath & a & "/{" & b & "," & c & "}/"

                       

                      do shell script mkdirStr 

                      • 8. Re: Creat a folder on Window desktop and name it after a field
                        philmodjunk
                          

                        I must be missing something.

                         

                        "export this field to a text file with box 'execute' checked then a new folder will be created"

                         

                        Are we talking about "export records" or something else? I don't see "text" as an option. I find Tab separated or comma separated text as the nearest options to what you describe.

                         

                        I don't see any 'execute' check box.

                         

                        This looks like a really nice way to fire off a batch file that was created on fly, but don't see quite how this would work...