• 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: sending data from one AppleScript App to another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sending data from one AppleScript App to another


  • Subject: Re: sending data from one AppleScript App to another
  • From: Nigel Smith <email@hidden>
  • Date: Wed, 03 Sep 2003 11:26:48 +0100

On 1/9/03 19:08, "Michael Glasser" <email@hidden> wrote:

> I am working on scripting AIM. Part of what I am doing is having an
> AIM script send data to another program... right now I do it in a very
> inefficient way... I have AIM send it to TextEdit, and then the other
> app reads the data from Text Edit and removes items as needed.


Why can't your script just get the data and then do whatever you want with
it -- including, for example, telling FMPro to make a new record with the
data?

> Is there a way to have the AIM script send data directly to another
> app?

If you really do want to separate out the functions for some reason, and
assuming the "other app" is an AppleScript application, then yes, you can.
Here's a really simple example:

--save this script as a stay-open application
--called "messageApp", then launch the application
property theMessage : ""

on setMessage(someText)
set theMessage to someText
end setMessage

on displayMessage()
display dialog "The message was:
\"" & theMessage & "\""
end displayMessage
--end messageApp script

--run this script from inside your script editor
set myMessage to text returned of <line-break>
(display dialog "Message to send:" default answer "")

tell application "messageApp"
activate
displayMessage()
delay 5
setMessage("I'm a new message")
displayMessage()
delay 5
setMessage(myMessage)
displayMessage()
setMessage("Quitting now...")
displayMessage()
quit
end tell
--end of script editor script

You can see thaqt you can send data to messageApp, and send commands to
messageApp, just like any other scriptable application.

> If I have it as a stand alone application, however, I always need to
> force quit... so I guess that is question #2. :)

You can just tell it to quit, as demonstrated above. And any stay-open app
should have a "Quit" menu item. The only reason you should have to force
quit it is if it constantly processing, so the quit event doesn't get a
chance. If that's the case then you need to rethink the script, since it
probably won't hear any other message you send it either...

HTH,

Nigel
_______________________________________________
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.

References: 
 >sending data from one AppleScript App to another (From: Michael Glasser <email@hidden>)

  • Prev by Date: Re: tell application "FileMaker Pro/Developer"
  • Next by Date: delimiter if not using only one?
  • Previous by thread: Re: sending data from one AppleScript App to another
  • Next by thread: Re: Re: sending data from one AppleScript App to another
  • Index(es):
    • Date
    • Thread