4 Replies Latest reply on Jul 19, 2010 4:05 AM by Mahesh_JW

    Path of the choose folder

    Mahesh_JW Level 1

      Hi all,

      what is the problem

       

       

      tell application "Finder"
          set SourceFolder to choose folder with prompt "Choose PDF Folder"
          set thePa to (path of SourceFolder) as string
          set theFileList to (entire contents of SourceFolder as alias list)
         
      end tell

       

       

      it throws

      can't make the path of alias "......" into type string

       

       

       

      help me what is the problem

        • 1. Re: Path of the choose folder
          Muppet Mark-QAl63s Level 4

          You have a couple of things mixed up here. Firstly 'choose folder' is from standard additions so this does not need to be inside the tell Finder block although it can. The choose folder command returns an 'alias file specifier' which is what Finder likes best so NO need to coerce to string then back to alias again. Just pass it straight as it is then have Finder get you all the files.

           

          set Source_Folder to choose folder with prompt "Choose PDF Folder"
          tell application "Finder"
               set File_List to (entire contents of Source_Folder)
          end tell
          
          

           

          Also you won't find much in the way of help here with regards to AppleScript this forum is very much aimed to those who are using JavaScript with Acrobat. You would get a better level of response here…

           

          http://macscripter.net/viewforum.php?id=2

          • 2. Re: Path of the choose folder
            Mahesh_JW Level 1

            Thanks Mark,


            but i received the error "cant make ...... as type string"

             

             

            set SourceFolder to choose folder with prompt "Choose PDF Folder"

            tell application "Finder"

                set thePath to (path of SourceFolder) as string
                set File_List to (entire contents of SourceFolder)
            end tell

             

            what to do....

             

            Mahesh

            • 3. Re: Path of the choose folder
              Muppet Mark-QAl63s Level 4

              You do NOT need to use the parenthesis () or 'path of'… Just ask for 'as text' or 'as string'

               

              set Source_Folder to choose folder with prompt "Choose PDF Folder"

               

              tell application "Finder"

              set Folder_String to Source_Folder as text

              set File_List to (entire contents of Source_Folder)

              end tell

              --

              Folder_String -- This will return the HFS path as text

               

              or

               

              set Source_Folder to choose folder with prompt "Choose PDF Folder"

               

              tell application "Finder"

              set Folder_String to Source_Folder as string

              set File_List to (entire contents of Source_Folder)

              end tell

              --

              Folder_String -- This will return the HFS path as text

              • 4. Re: Path of the choose folder
                Mahesh_JW Level 1

                It works well.

                 

                Thanks Mark...