• 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: Set Contents not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set Contents not working


  • Subject: Re: Set Contents not working
  • From: kai <email@hidden>
  • Date: Mon, 14 Nov 2005 18:16:28 +0000


On 14 Nov 2005, at 17:14, Ted wrote:

tell application "TextEdit"
make new document
set the contents of front document to "Database report on " & dName & return & return
I'm getting the following error in Script Editor:


"TextEdit got an error: Can't make contents of document 1 into type reference."

Can someone tell me what I'm doing wrong? I've looked through the TextEdit dictionary, but it seems like it should work.

You should need only a minor modification, Ted. From the TextEdit suite of TextEdit's dictionary:


----------

document n [inh. document; see also Standard Suite] : A TextEdit document.
elements
contained by application, application.
properties
text (text) : The text of the document.


----------

So try something like:

----------

tell application "TextEdit"
make new document
set the text of front document to "Database report on " & dName & return & return
end tell


----------

More concisely, you should also be able to do this:

----------

tell application "TextEdit" to make new document with properties {text:"Database report on " & dName & return & return}

----------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Set Contents not working (From: Ted <email@hidden>)

  • Prev by Date: Re: 10.4.3 changed what?
  • Next by Date: Re: when words aren't words
  • Previous by thread: Set Contents not working
  • Next by thread: Re: Set Contents not working
  • Index(es):
    • Date
    • Thread