Applescript: Open up a terminal cd'ed to a defined location.

Discussion in 'Mac Programming' started by IMcD23, Jun 28, 2010.

  1. IMcD23 macrumors regular

    IMcD23

    Joined:
    Aug 4, 2007
    Location:
    Iowa, United States, Earth, Milky Way, . . .
    #1
    Hello all,

    I am stumped on this issue.

    I would like to create an applescript where it displays a dialog asking the location I would like to cd to. it will then open up a terminal window cd'ed to the location I defined.

    This is what I have so far:
    Code:
    set location to ""
    display dialog "Enter the location:" default answer location buttons {"OK"} default button 1
    set location to text returned of the result
    tell application "Terminal"
    	activate
    	do script "cd ______"
    end tell
    EDIT: i just changed the line do script "cd ______" to do script "cd" & location

    never mind, it works for me! :)
     
  2. Lokrado macrumors regular

    Joined:
    Jan 26, 2009
    Location:
    Denmark

Share This Page