2 Replies Latest reply on May 7, 2015 10:58 AM by Fred_3

    Using a Field in AppleScript

    Fred_3

      Title

      Using a Field in AppleScript

      Post

       

      My AppleScript works, but not when I try to pass a field from a record for the folder name.  I have tried multiple combinations, but haven't found the correct one.  The folder should be LAST NAME followed by a space and a dash and another space and then the ID, i.e.      Johnson - 27

      "tell application \"Finder\"" & ¶ & 
          "activate" & ¶ &
              "make new Finder window to disk \"Douglas\"" & ¶ &
          "set target of Finder window 1 to folder \Residential Customers::Last Name" - "Residential Customers::Customer ID"\" of folder \"Residential\" of folder \"Customers\" of disk \"Douglas\"" & ¶ &
      "end tell"

      Any thoughts?  Thanks.  Fred

        • 1. Re: Using a Field in AppleScript
          Jade

          You are close.  You need to concatenate the fields to the applescript text string…

          "set target of Finder window 1 to folder \"" & Residential Customers::Last Name & " - " & Residential Customers::Customers ID & "\" of …

          There are a few ways to simplify these applescripts: 

          • Use the List(line 1; line 2; …) function.  This removes the need for '& ¶ &' at the end of each line.

          • Use Quote() function to place quotes around field values.  This removes the need to escape quotes \"

          • Use the applescript 'the quoted form of …'.  This removes the need to escape quotes \"

          • 2. Re: Using a Field in AppleScript
            Fred_3

            Awesome!  Works great.  Thank you very much.  Fred