• 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: Can't tell an application to open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't tell an application to open


  • Subject: Re: Can't tell an application to open
  • From: Dave <email@hidden>
  • Date: Sun, 20 Feb 2011 17:17:58 -0600

On Feb 20, 2011, at 2:39 PM, Laine Lee wrote:

> Provided “theFile” is an hfs file path (colon-delimited text), this should
> work (it did for me, credit goes to Shane's book):
>
> tell current application to tell application "TextWrangler" to open theFile

Yes, theFile is a colon delimited text string but I still get:

	<<script DebugLog>>  doesn't understand the open message


On Feb 20, 2011, at 3:22 PM, Shane Stanley wrote:

> That sounds like a problem with theFile. You're syntax works fine -- try
> this and see:
>
>        set theFile to choose file
>        tell application "TextWrangler"
>            set textDocument to open theFile
>        end tell
>
> You have probably made theFile by using POSIX path or alias as a specifier
> rather than as a coercion -- the result of doing so returns the script
> object rather than a reference to the file, which would explain what you're
> seeing. (Something similar happens with file, but I doubt that you used
> that.)

Yes, I am using a POSIX path since the file may not yet exist. (TextWrangler automatically associates the returned window with the file whether it exists or not, which is exactly what I need.)

Your above choose file code works but can't be used since this is a background application that is not permitted to interact with the user. Obviously, I can't use an alias since the file may not yet exist. So is there a cleaner way to get the equivalent of POSIX path in ASOC?

Thanks in advance _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can't tell an application to open
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Can't tell an application to open (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Can't tell an application to open
  • Next by Date: Re: Can't tell an application to open
  • Previous by thread: Re: Can't tell an application to open
  • Next by thread: Re: Can't tell an application to open
  • Index(es):
    • Date
    • Thread