Re: osascript problems
Re: osascript problems
- Subject: Re: osascript problems
- From: "Chris Espinosa" <email@hidden>
- Date: Fri, 3 Jan 2003 14:57:52 -0800
>
From: "Philip T. Gonia" <email@hidden>
>
Sent: Friday, January 03, 2003 2:15 PM
>
Subject: osascript problems
>
>
Any MAC OS X (Unix) and Applescript guru's out there?
>
>
I am trying to use osascript in a bash shell to get input from a user.
>
>
The bash script is as follows:
>
>
#! /bin/bash
>
>
CVSROOT=`osascript getCVSRootDirectory.applescript`
>
echo CVSROOT
>
>
The applescript is as follows:
>
>
display dialog "Location of CVS root repository." default answer "Enter
>
your CVS root directory here."
>
set cvsRoot to (text returned of result)
>
return cvsRoot
>
>
With both scripts located in the same directory and permissions set to
>
755 (rwxr-xr-x) for both files I ran the bash script in terminal
>
with the following command.
>
>
./getCVSRepository
>
(The name I gave to the bash script.)
>
>
What I am seeing is that the dialog is displayed with the default text
>
hi-lighted as you would expect. But when typing into the dialog the
>
default text or text field is not updated. Also while typing into the
>
dialog the input typed is echoed right out to the terminal window.
>
Selecting the "OK" button will not close the dialog either. You have to
>
use control-c to terminate the script. (WARNING -- If you run this bash
>
script in the background by using the "&" char. you will have to use
>
the kill command twice. Once to kill off the applescript process and
>
once to kill off the dialog or child process.)
>
>
What I am wishing to do is to create a ProjectBuilder User Script that
>
extends the CVS features for PB. This combination of PB user scripting
>
with standard unix tools and applescript is very powerful. My hopes are
>
that someone on this list can help explain what is going on with this.
A shell tool run from Terminal doesn't have privileges to interact with the
user via the graphic user interface. Try telling an app that does, e.g. the
Finder or System Events:
tell application "System Events"
activate
display dialog "Location of CVS root repository." default answer "Enter
your CVS root directory here."
set cvsRoot to (text returned of result)
return cvsRoot
end tell
Chris
_______________________________________________
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.