• 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
osacompile requires evaluation of "tell application" statements?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

osacompile requires evaluation of "tell application" statements?


  • Subject: osacompile requires evaluation of "tell application" statements?
  • From: "David Litwin" <email@hidden>
  • Date: Fri, 25 Apr 2008 15:12:59 -0700
  • Thread-topic: osacompile requires evaluation of "tell application" statements?

I have a very simple script to tell one of my helper apps to show a special dialog (it normally runs hidden in the background).  I don’t want to launch the app if it isn’t already running, but I do want to bring up that dialog if it is running.  The applescript is:

 

ShowMyApp.applescript:

==================

on run

    tell application "System Events"

        set running to exists application process "MyApp"

    end tell

 

    if (running) then

        tell application "MyApp" to showthespecialdialog

    else

        display dialog "MyApp can not be shown, it is not running"

    end if

end run

==================

 

When I compile this app with osacompile it fails with the following error:

 

ShowMyApp.applescript:7: An error of type 1 has occurred (1)

 

If MyApp happens to be running on the development machine when osacompile is invoked, it will succeed.

 

In proper use MyApp (a helper app) is launched from a main app with inherited pipes set up for communication.  It will exit itself immediately if not properly run.  So apparently when osacompile tries to launch it as part of compiling the ‘tell application "MyApp" to reveal’ line, it does not stay around long enough for osacompile to get what it needs.

 

Why is it that merely compiling a script requires actually launching the app of a 'tell application "SomeApp" ' _expression_?

 

I build the MyApp application before compiling this script so the app exists to be run, but I don’t want to try to falsely force it to run on the build machine just so I can compile a script to send it a message.  I suppose I could put the compiled script (compiled on a machine that happens to be running that app at the time) into source control, but that is a poor solution.

 

If I am going about this task the wrong way, can I get some tips on how to solve this problem better?  Perhaps I am a poor searcher, but I didn’t find much on this issue on the apple lists or general Google searching.

 

Thanks,

 

David Litwin

 _______________________________________________
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

  • Prev by Date: Re: Script to add alias to dock
  • Next by Date: Using Script Editor
  • Previous by thread: Re: INDESIGN CS3: Auto-run a Script on Document Open
  • Next by thread: Using Script Editor
  • Index(es):
    • Date
    • Thread