|
#1
| ||||
| ||||
| I have a script that asks for a file name and then opens a specific directory and inside the terminal. It then opens vi within the terminal with that filename: display dialog ¬ "Please enter name of project file:" default answer "samp.c" buttons {"Ok", "Cancel"} ¬ default button "Ok" if button returned of result = "Ok" then set z to text returned of result else exit repeat end if tell application "Terminal" do script "pushd Sandbox/Programming/Code_src/C" do script "vi " & z end tell The problem here is that (#1, I'm not a very prolific Applescript programmer. But besides that ...) if the terminal is not open this script will open a terminal window, open another terminal window and launch the command "pushd Sandbox/Programming/Code_src/C", and then open another window and execute the command '"vi " & z'. I would like the applescript to just open one terminal window and then launch the two unix commands inside that one single window so that I have only one terminal window open when it is all said and done. One way to get the two commands to execute sequentially in one window is to change the 'do script' lines to: do script "pushd Sandbox/Programming/Code_src/C; vi " & z This is basically a Unix fix and I still have two terminal windows open if the Terminal.app is not already active. So how do I accomplish my gaol in a more 'Applescript' kind of way? Thanks in advance. SA ![]()
__________________ I can do everyhting on my Mac I used to do on my PC, plus alot more. --Me |
|
#2
| |||
| |||
| Remove the tell application "Terminal". Call your shell commands with: do shell sript "/path/to/executable -flags" |
|
#3
| ||||
| ||||
| Nope. That does not work for the pushd command. All I get is a Terminal window with no change in pwd. i want the first window that pops open to change directories to a specific directory using the "pushd" command. do shell script "pushd /whatever/Directory/I/Wish/to/Change/to" This does not work because there is no where to direct the output to the command. This however does do nicely for some unix commands that print their output to the screen(Except top). Thanks. SA ![]()
__________________ I can do everyhting on my Mac I used to do on my PC, plus alot more. --Me |
|
#4
| |||
| |||
| Stick "in window 1" to the end of your do script commands. Like this: do script "pushd Sandbox/Programming/Code_src/C" in window 1 And that'll do it in the first window that was opened (or that opens when Terminal launches)
__________________ =) <>< public key id: EE4B2E09 |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A newbie terminal question and a XDarwin question | ethanS | Unix & X11 | 4 | January 7th, 2003 10:48 AM |
| OS X Server question | mindbend | Mac OS X System & Mac Software | 1 | September 12th, 2002 11:54 AM |
| Router question and .asf files question | simX | Apple News, Rumors & Discussion | 1 | December 18th, 2001 01:51 AM |
| SMB question | NikeiBook | Mac OS X System & Mac Software | 1 | October 20th, 2001 10:17 AM |
| unix newbie question | jmmistrot | Mac OS X System & Mac Software | 3 | October 12th, 2001 02:49 AM |