• 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: Passing calls to an AS app via shell?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing calls to an AS app via shell?


  • Subject: Re: Passing calls to an AS app via shell?
  • From: Graff <email@hidden>
  • Date: Fri, 08 Oct 2004 12:10:48 -0400

You should be able to simply tell the applet to perform a handler:

Save this script with the name TestApp.app as a stay-open application:
----
global timeString

on run {}
	set timeString to (current date) as string
end run

on idle
	set timeString to (current date) as string
	return 10
end idle

on DisplayString(theString)
	display dialog "" & theString & return & timeString
end DisplayString
----

make a new script with this text:
----
tell application "TestApp"
	DisplayString("this is a test")
end tell
----

Run TestApp.app and then run the second script.

You'll see that TestApp.app runs the code in its "DisplayString" handler. You can do this from the shell by doing:
osascript -e 'tell application "TestApp.app" to DisplayString("testing")'


- Ken

On Oct 8, 2004, at 6:13 AM, Johnny AppleScript wrote:

I hope I can make this question clear.

JavaScript can pass calls out to the shell, just like AS can. E.G.:

    message="echo hello world"
    system(message)

...will indeed write the string to console.log, and I can, of course, read
the data from console.log, but I don’t want to actually write/read the data
to disk, if I can help it. Using the Clipboard is not an option, either.


message="osascript -e 'tell application \"System Events\" to display
dialog \"hello world\"’"
system(message)


...will at least do exactly as expected. Great.

Now, I want to know if there’s a way to pass the string (hello world)
directly to a running applet, preferably without the use of osascript.

If I have an applet, say, ‘myRunningApp.app’, which is always running in the
background, I think I can pass a variable to it from osascript, and then
have it act on it, correct? What I really want to do is avoid the (albeit
short) delay created by use of osascript commands. Does anyone know of a way
for an idling Applet to “listen” for calls from the system or shell, and act
on them, without writing data to a text file?


Short of that, I think I can figure out the osascript method, but if anyone
has any samples, I’d appreciate it.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Passing calls to an AS app via shell?
      • From: Johnny AppleScript <email@hidden>
References: 
 >Passing calls to an AS app via shell? (From: Johnny AppleScript <email@hidden>)

  • Prev by Date: Re: Extract words.
  • Next by Date: [~ot] those pesky invisible folders ...
  • Previous by thread: Re: Passing calls to an AS app via shell?
  • Next by thread: Re: Passing calls to an AS app via shell?
  • Index(es):
    • Date
    • Thread