• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Terminal Scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Terminal Scripting


  • Subject: Re: Terminal Scripting
  • From: Rick Davis <email@hidden>
  • Date: Mon, 1 Mar 2004 08:51:05 -0500

Heya,

A little late in joining this discussion. But, I'm curious. I've been working with a few applescripts and the terminal app and have not had to tell the Terminal to activate. If I just add the line
-- do shell script "hdiutil create -srcfolder /TestBackup /Volumes/Saturday/testbackup.dmg" -- in an applescript (other parts of the applescript mount a remote server sharepoint according to which day it is to be run), the terminal app opens and runs. If the terminal is already open then a new window is opened, then the command is run. My dilemma has been how to tell the terminal to quit when the command has completed. Because the amount of time needed varies according to the size of the source folder being imaged I have hesitated using a timeout call. I am assuming I need to add something to tell the terminal to check for the status of the command called and then quit once that process is idle (??).

Reading through this thread I had two questions.

1) There is no menu option or anything referring to a window in the terminal other than bringing all to the front or switching between open windows from the Window menu bar item. What is normally a new window option in most apps is "New Shell" in Terminal. Does that mean we have to refer to shells instead of windows when closing. When you close a shell/window you usually get a dialog box asking if you want to terminate whatever process is running in the shell/window you are closing. How does one deal with that via applescript?

2) Everything I have read show the command as "do shell script" when scripting the terminal. Yet this thread read "do script". Is there a difference?

Just starting out with terminal and other cli usage and scripting, so please excuse any questions that may be obvious.

Rick Davis

On Feb 29, 2004, at 1:00 AM, email@hidden wrote:

Message: 3
Date: Sat, 28 Feb 2004 08:27:01 +0000
Subject: Re: Terminal Scripting
From: Martin Orpen <email@hidden>
To: Kris Jensen <email@hidden>
CC: AppleScript <email@hidden>

on 28/2/04 1:43 am, Kris Jensen at email@hidden wrote:

I tried all of the scripts suggested so far on my 450...none worked.

I'm running Terminal 1.4.1 (v100)
Script Editor 2.0 (v43)
Applescript 1.9.3

I'd really appreciate any ideas on things to try. This seems trivial,
yet it's taking way too much time...

Sounds very odd to me.

I run tcsh and have customised the environment too much to trust it to
behave in a standard manner. So I've just run the following script on a
fresh Panther installation (bash terminal) on a G4 Cube:

tell application "Terminal"
activate
do script "ls -al"
end tell

And, as usual, I got two windows on the first run - a blank one and one with
the command - and a new window doing the requested command on each
successive run.

Does your Terminal work normally when you enter commands directly rather
than via AppleScript?

--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Terminal Scripting
      • From: Dave Balderstone <email@hidden>
  • Prev by Date: RE: InformationWindow: How do I get info from ...
  • Next by Date: Re: Terminal Scripting
  • Previous by thread: RE: InformationWindow: How do I get info from ...
  • Next by thread: Re: Terminal Scripting
  • Index(es):
    • Date
    • Thread