• 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: How to create a document?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a document?


  • Subject: Re: How to create a document?
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 05 Jun 2016 10:15:04 +0200


Le 5 juin 2016 à 09:00, 2551phil <email@hidden> a écrit :

and by way of expansion: 


set testFile to "This is a test.txt"
set thePath to POSIX file ("/Users/<user name here>/Desktop/" & testFile)
tell application "TextEdit"
activate
make new document
set text of document 1 to "one two three"
set document 1's name to testFile
close document 1 saving yes saving in thePath
end tell


and to have a script independant of the host, and for lazy typist  :

set testFile to "This is a test.txt"
set thePath to ((path to desktop as text) & testFile) as «class furl»
tell application "TextEdit"
activate
make new document
tell document 1
set its text to "one two three"
set its name to testFile
close it saving yes saving in thePath
end tell
end tell


Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) dimanche 5 juin 2016 10:15:00




 _______________________________________________
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: How to create a document?
      • From: 2551phil <email@hidden>
References: 
 >How to create a document? (From: Mitchell L Model <email@hidden>)
 >Re: How to create a document? (From: 2551phil <email@hidden>)
 >Re: How to create a document? (From: 2551phil <email@hidden>)

  • Prev by Date: Re: How to create a document?
  • Next by Date: Re: How to create a document?
  • Previous by thread: Re: How to create a document?
  • Next by thread: Re: How to create a document?
  • Index(es):
    • Date
    • Thread