basic applescript opening directorys problem?

Discussion in 'Web Design and Development' started by boomtopper, Sep 9, 2006.

  1. boomtopper macrumors member

    boomtopper

    Joined:
    Mar 25, 2004
    Location:
    UK Huddersfield
    #1
    Hi everyone,
    I am currently learing applescript and have a fairly basic problem that i can't work out. Heres the code:-

    Code:
    tell application "Finder"
    	set chosenDir to text returned of (display dialog "Open this directory" default answer "/usr/bin/")
    	open folder (POSIX file chosenDir)
    end tell
    What this should do is display a dialog box and ask for a directory. For this i have set it up to open "/usr/bin/". The next part should open the directory but it does not. This part of the code is where the problem is and i can't figure it out.
    Cheers, Richard
     
  2. boomtopper thread starter macrumors member

    boomtopper

    Joined:
    Mar 25, 2004
    Location:
    UK Huddersfield
    #2
    its all cool now i sat down and tried to work it out and have managed to. Here is the results!

    Code:
    tell application "Finder"
    	set chosenDir to text returned of (display dialog "Open this directory" default answer "/usr/bin/")
    	open folder (chosenDir as POSIX file)
    end tell
    as you can see the problem originally was becuase i was trying to open a string. When what i needed to do is cast the string to a POSIX file and bobs your uncle.

    cheers, Richard
     

Share This Page