• 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 14:32:02 -0600

On Feb 20, 2011, at 11:48 AM, Alex Zavatone wrote:

try this:

tell application "Finder" to open theFile with application "TextWrangler"

I can't get that line to compile in XCode or Script Editor/Debugger. (Also tried parens around the last part.)
It gets:

Expected "given", "with", "without", other parameter name, etc. but found """.


For those interested, I've managed the following huge workaround, at least for TextWrangler, although unlike the original open command this could go to the wrong window if more than one window has the same name:

property DebugLogName : "HotLog Log" -- log file name
property DebugLogDir : "/tmp/"
property DebugLogPath : DebugLogDir & DebugLogName -- path to use

on WriteLineTextWrangler(logLine)
  set theFile to POSIX file DebugLogPath
  tell application "TextWrangler"
  try
(*  THIS DOESN'T WORK IN APPLESCRIPT OBJECTIVE-C Snow Leopard 10.6.6
The open always goes to the script and not the tell
set textDocument to open theFile
*)
set textDocument to first document whose name is DebugLogName
    on error
        -- document not in a window
        try
set theAlias to theFile as alias
on error
-- file does not yet exist
set textDocument to make new document with properties {name:DebugLogName}
try
do shell script "touch " & quoted form of DebugLogPath
set theAlias to theFile as alias
save textDocument to theAlias
end try
end try
    end try
    tell text of textDocument -- won't work as one tell line
        make new line with properties {contents:logLine & return}
   end tell
    -- scroll window to the bottom
    tell window of textDocument to select insertion point after last character
  end tell
 _______________________________________________
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: Laine Lee <email@hidden>
References: 
 >Can't tell an application to open (From: Dave <email@hidden>)
 >Re: Can't tell an application to open (From: Alex Zavatone <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