Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > help me write a script to run in Terminal

help me write a script to run in Terminal
Thread Tools
surfacto
Dedicated MacNNer
Join Date: Oct 2001
Location: California
Status: Offline
Reply With Quote
Aug 1, 2003, 08:50 PM
 
I am using a piece of software called labview, which will allow me to send Applescript to run in specific programs. All I want to do is have it open a terminal window and execute the following commands:

% cd workingdirectory

% flic.command

where flic.command is an executable file. Unfortunately, I have no experience with applescript, but I have seen that many of you out there are quite proficient at it. Where to begin?

Another question: labview requires that I specify a Target ID for the requested application. Any ideas what this is?
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Aug 2, 2003, 09:52 AM
 
surfacto-

A good place to start is with the man osascript command. Osascript calls and excutes other scripting environments.

Craig
     
Gary Kerbaugh
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status: Offline
Reply With Quote
Aug 4, 2003, 01:54 PM
 
   I believe that the commands you're looking for are AppleScript's "do shell script" and "do script" commands. The first executes the string argument (shell command(s)) in a Bourne shell, "sh" but doesn't need or use a terminal window. The second is a command in the Terminal's dictionary and so must be directed at a Terminal window. In this case, it's necessary to have a reference to such a window; not a big deal but slightly more involved.
   A good reference for "do shell script" is do shell script in AppleScript and a couple of examples for scripting a Terminal window can be found at Scriptable Applications: Terminal. If that isn't enough, searching the web will turn up a few others.
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:06 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,