11 Replies Latest reply on Oct 4, 2009 2:25 AM by ijontichy

    Get (Desktop Path)

    ijontichy

      Title

      Get (Desktop Path)

      Post

      FMS 10

      FMP 10 Advanced

      Mac 10.6.1

      (above average tinkerer with the software).

       

       

      I have a functioning script that exports an excel document to my desktop prenamed and dated, etc etc.   (Depended very heavily on a sample provided with the program.)

       

      However, if I change the name of my hard drive from the  default "Macintosh HD" it can no longer write the file.

       

      I'm okay keeping my hard drive named that but others using this script might not want to and no, I do not need to worry about the Windows users--there are none for this database. 

       

      Thanks in advance!

        • 1. Re: Get (Desktop Path)
          Heine_1
            

          hi pirxx!

           

          You can use Get ( DesktopPath ).

          What I would do ( if you wish to store the file in question on the user's desktop ) is to create a variable $path and set it to be Get ( DesktopPath ).

          It will get the path to the desktop on the current users system, and it is not hard coded.

           

          After that, you can use the variable to show FileMaker where you want the Excel file to be exported to!

           

          You are able to use the content of a variable as a path in the export dialog box.

           

          Hope this helps!

           

          /Cheers 

          • 2. Re: Get (Desktop Path)
            ijontichy
              

            I do set a variable and that's not working.   But maybe I need to set the variable earlier?   Here's the line from the script.

             

            Set Variable [$filePathe; Value: Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"]

             

             

            and then

             

             

            Export Records [No dialog; "$filePathe" ' Unicode (UTF-16)]

             

             

            But if I change the name of my harddrive...no luck.     

            • 3. Re: Get (Desktop Path)
              ijontichy
                

              Here's the specific error dlalog box that comes up:

               

              "DATALOG_as_of__10_3_2009.xlsx" could not be created on this disk.   Use a different name, make more room on the disk, unlock it or use a different disk."

              • 4. Re: Get (Desktop Path)
                Heine_1
                  

                Hi again!

                 

                Try adding ""filemac:" & Get ( DesktopPath ) & your_filespecific_name.

                 

                I got the same error until I added "filemac"... brain fart!

                 

                Sorry, I should have spotted that one!

                 

                /Cheers 

                • 5. Re: Get (Desktop Path)
                  ijontichy
                    

                  Doesn't work but maybe I'm unclear on the formatting:

                   

                  I tried

                   

                  Set Variable [$filePathe; Value: "filemac:" & Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"]

                   

                  and I tried

                   

                  Set Variable [$filePathe; Value: filemac: & Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"]

                   

                  and no luck.

                  • 6. Re: Get (Desktop Path)
                    comment_1
                      

                    pirxx wrote:

                    I tried

                     

                    Set Variable [$filePathe; Value: "filemac:" & Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"]

                     

                    and I tried

                     

                    Set Variable [$filePathe; Value: filemac: & Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"]


                    Neither one is a valid calculation syntax. Filemaker would not let you "try" this,  so you're probably not quoting your calculation correctly. Anyway, I am guessing you want something like:

                    "filemac:" & Get (DesktopPath) & "DATALOG_as_of_" & Substitute ( Get (CurrentDate ) ; "/"; "_")  & ".xlsx"

                     

                     

                    • 7. Re: Get (Desktop Path)
                      ijontichy
                        

                      What I typed in is how it appears in the script line:   Everything after "value:" is the calculation and it's exactly as you suggested and still no luck.   Thanks, though!

                       

                      e.

                      • 8. Re: Get (Desktop Path)
                        comment_1
                          

                        pirxx wrote:

                        What I typed in is how it appears in the script line


                         

                        That's not possible. If you try to enter your formula:

                         

                        "filemac:" & Get (DesktopPath) & "DATALOG_as_of__" & Substitute ((Get(CurrentDate)) ; "/"; "_"_ & ".xlsx"y

                        you will get an error of "The specified table cannot be found" and you won't be able to proceed until you fix it.

                         

                         


                        pirxx wrote:

                        Everything after "value:" is the calculation and it's exactly as you suggested


                         

                        What I suggested is significantly different.



                        • 9. Re: Get (Desktop Path)
                          ijontichy
                            

                          unnoticed typo.

                           

                          Sorry.

                           

                          Here's the calculation

                           

                          "filemac:" & Get ( DesktopPath) & "DATALOG_as_of__" & Substitute ( (Get(CurrentDate)) ; "/" ; "_" ) & ".xlsx"

                           

                          Regardless, unless my hard drive is named Macintosh HD, this does not work.

                          • 10. Re: Get (Desktop Path)
                            Heine_1
                              

                            Hi pirxx!

                             

                            Are you changing the name of your hard drive while having FileMaker open? That could be the thing. Try quitting FileMaker, change the name of your hard drive and then re-launch FileMaker ... then run the script!

                             

                            /Cheers 

                            • 11. Re: Get (Desktop Path)
                              ijontichy
                                 That did it.   filemac:   worked.   Thanks!