• 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: osascript and *.command files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: osascript and *.command files


  • Subject: Re: osascript and *.command files
  • From: Thomas Treichl <email@hidden>
  • Date: Sun, 07 Oct 2007 18:25:51 +0200

Axel Luttgens schrieb:
On 7/10/07 11:18, Thomas Treichl wrote:

Hi,

I'm having a problem if I try to run eg. a shell script from a *.command file written with osascript. In detail, I have the following part of code saved in the file test.command and placed on my Desktop:

  osascript 2>&1>/dev/null <<EOF
    tell application "Terminal"
      activate
      do script "ls"
    end tell
  EOF

I double-click the test.command, two Terminal.app windows open (the first one already shows a 'process terminated' message - forget about that window) and the second window shows me the output of 'ls'. I expect that I can use this second window for my ongoing work,

Do you mean interactively, by entering commands on the keyboard?

Right Axel, by entering commands on the keyboard. It works if I call scripts like 'ls' or if I open any other application with the 'open' command. But if I try to open an other application that eg. has an other osascript included then nothing happens anymore. This currently is a big problem.


ie. I try to call another *.command file (or the same *.command file) with the 'open' command, ie.

  open ~/Desktop/other.command
or
  open ~/Desktop/test.command

and I see that I can't see anything starting/happening anymore. The Terminal window seems to be some kind of frozen. I expect I'm having a mistake in my example above but I don't have any idea where it is?

What happens if you run the .command file directly, e.g. by typing:

~/Desktop/other.command

Sure that works.

After all, the .command file is just a regular shell script, and Terminal.app is already opened.

It seems to be not, because shell scripts can be called without any problem. I expect the problem is somewhere in the osascript part of the example file but I don't know for sure.


But I'm not sure to have correctly understood your question.
Axel

My example code from above is just a small part of a startup script that I use for the startup of a special application. A user reported that if he uses this startup procedure then he can't open any other *.command files anymore that should do some Terminal.app output by double-clicking the icon (in Finder or on Desktop).


Another example so that you can reproduce my problem:
Create the file example.command with the code from above. Double-click it the first time and see two windows will be opened. Double-click it a second time and see that nothing happens anymore (but actually I would expect that another 'ls' is done?!).


  Thomas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: osascript and *.command files
      • From: Axel Luttgens <email@hidden>
References: 
 >osascript and *.command files (From: Thomas Treichl <email@hidden>)
 >Re: osascript and *.command files (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Set bounds of a window with NO dictionary
  • Next by Date: Original item of alias file
  • Previous by thread: Re: osascript and *.command files
  • Next by thread: Re: osascript and *.command files
  • Index(es):
    • Date
    • Thread