• 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[4]: tell app, name in string var
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[4]: tell app, name in string var


  • Subject: Re[4]: tell app, name in string var
  • From: Leonid Bogdanov <email@hidden>
  • Date: Tue, 17 May 2011 18:42:59 +0400

Zack,

  Thank you for your answer. I was aware of this trick.
   I thought that I just didn't know how to correctly write my script, that it had some syntactic problems.

  But it turned out that it is AppleScript pecularities.


Tue, 17 May 2011 07:28:02 -0700 letter from Zack Jarrett <email@hidden>:

> There's a very ugly way to do this, and it's fragile, but it will work if you
> KNOW FOR SURE that the targeted application is on the system.
>
> What you do is build up your desired script as a string so that AppleScript
> doesn't attempt to compile it at compile time.  The string will only be
> compiled at runtime (during the run script).  Doing this is klunky, fragile,
> and definitely ugly for longer scripts, but it can be an appropriate solution.
>
> Here's an example, using your scenario:
>
> set appName to "Microsoft Excel"
> set s to "tell application " & quote & appName & quote & return & "return
> display alerts" & return & "end tell"
> set theResult to run script s
>
>
> This will result in a runtime exception if Excel doesn't exist on the system
> where this is running.
>
> Good luck!
> Zack
>
> On May 17, 2011, at 6:07 AM, Leonid Bogdanov wrote:
>
> > Shane,
> >
> >  Looks nice, but again, app name is hardcoded in one statement :)
> >    using terms from application "Microsoft Excel"
> >
> >  and
> >    using terms from application appName
> >
> >  doesn't work.
> >
> >
>
> _______________________________________________
> 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
 _______________________________________________
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: tell app, name in string var
      • From: Christopher Nebel <email@hidden>
References: 
 >Re[2]: tell app, name in string var (From: Leonid Bogdanov <email@hidden>)
 >tell app, name in string var (From: Leonid Bogdanov <email@hidden>)
 >Re: Re[2]: tell app, name in string var (From: Zack Jarrett <email@hidden>)

  • Prev by Date: Re: Re[2]: tell app, name in string var
  • Next by Date: Property of a record
  • Previous by thread: Re: Re[2]: tell app, name in string var
  • Next by thread: Re: tell app, name in string var
  • Index(es):
    • Date
    • Thread