4 Replies Latest reply on Jan 25, 2007 12:39 AM by zzzorro

    finder windows using shell_cmd

    TomMoore
      I've been trying to get my app to open a network share in a finder window using the shell_cmd function of the shell xtra (see code below, had to do a substitute to add quotes around each bit of the path), which gives the following alert:

      open /Volumes/'USERS'/'_SHARED'/'My Application'/'My Folder'/

      However it doesn't work when I use this as the argument for shell_cmd() and I get this error in the console:

      LSCopyItemInfoForURL() returned -35 for path /Volumes/USERS/_SHARED/My Application/My Folder/
      Couldn't open file /Volumes/USERS/_SHARED/My Application/My Folder/

      This is strange as when I type the command into the terminal it works fine. I'm totally stuck... and what does the LSCopyItemInfoForURL error mean, can't find a reference to it.

      Thank you!

        • 1. Re: finder windows using shell_cmd
          Level 7
          Since you refer to Finder windows I'll guess you're running this on a Mac.
          The following is the result of the command you string together:
          "open /Volumes/'D'/'\Macromedia\Director MX 2004\My Folder'/"
          which looks wrong.
          The single quotes shouldn't be there, or perhaps rather the entire path
          should be surrounded by a pair of single/double quotes.
          Also, be careful that you know what you're doing when using backslashes
          to create a posix path. Can you start with a valid HFS-type path and use
          shell_hfs2posix() and compare that to your posix path?
          • 2. Re: finder windows using shell_cmd
            TomMoore Level 1
            Thanks Sean,

            As you are running a PC, my substitution function won't work as I'm substituting the ":" from a mac formatted path to a "/" , i.e. "Volumes:Users:_Shared:My Application:My Folder" to "/Volumes/Users/_Shared/My Application/My Folder"

            I was quoting each bit of the path as I read in another post that this was recommended as I had spaces in my path... but I didn't know about shell_hfs2posix(). That would have saved loads of head scratching, thank you... and as a result I got it to work.

            Thanks!
            • 3. Re: finder windows using shell_cmd
              Level 7
              > I was quoting each bit of the path as I read in another post that this was
              > recommended as I had spaces in my path...

              It seems to me that spaces are delimited with a back slash, so that
              Applications/Director MX 2004/
              would become
              Applications/Director\ MX\ 2004/
              and you shouldn't need quote marks in your path string anywhere.

              But you have it working for you already, so that's good.
              • 4. Re: finder windows using shell_cmd
                you know, that you do not need shell xtra to reveal a folder in the finder?
                try in the message window:
                open the_path with "Finder.app"