• 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: TextEdit Save Problem (Thomas Maffucci)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit Save Problem (Thomas Maffucci)


  • Subject: Re: TextEdit Save Problem (Thomas Maffucci)
  • From: "koenig.yvan" <email@hidden>
  • Date: Thu, 24 Jan 2013 10:43:39 +0100


Le 24/01/2013 à 08:48, Christopher Stone <email@hidden> a écrit :

On Jan 23, 2013, at 16:01, Thomas Maffucci <email@hidden> wrote:
Thanks Brian for your prompt rely but I am sorry to say but right out of the box your suggestion failed.
I am still unable to save the text due to permission problems.
______________________________________________________________________

Hey Thomas,

There was a long thread about this sort of problem late last year:

http://lists.apple.com/archives/applescript-users/2012/Oct/msg00109.html

…

By contrast this one works:

tell application "TextEdit"
set newFile to (((path to desktop) as text) & "New_Doc.rtf")
set newFile to POSIX path of newFile
set _doc to make new document with properties {path:newFile}
set text of _doc to "This is sample text"
save _doc
end tell

I don't know if Apple will ever fix the list archive search engine, but you can use Google:

site:http://lists.apple.com/archives/applescript-users textedit save problem

--
Best Regards,
Chris

I apologize Chris but when I ran it, your proposal fails.

tell application "TextEdit"
path to desktop
--> error number -1708
«event ascrgdut»
--> error number -1708
path to desktop
--> alias "Macintosh HD:Users:yvankoenig:Desktop:"
make new document with properties {path:"/Users/yvankoenig/Desktop/New_Doc.rtf"}
--> document "New_Doc.rtf"
set every text of document "New_Doc.rtf" to "This is sample text"
save document "New_Doc.rtf"
--> error number -10000

Résultat :

error "Erreur dans TextEdit : Le gestionnaire AppleEvent a échoué." number -10000


I know well the « long thread » in which I posted.
It would be fine to read :

http://lists.apple.com/archives/applescript-users/2012/Oct/msg00110.html
http://lists.apple.com/archives/applescript-users/2012/Oct/msg00111.html
http://lists.apple.com/archives/applescript-users/2012/Oct/msg00113.html

I edited the OP's script accordingly :

set ptd to path to desktop
set getpage to "This is a test"

set filelst to {"FedMangrealtxt", "AmCentPosBal", "AmCentrealtxt"}

repeat with File_item in filelst
set newName to File_item & ".rtf"
tell application "System Events"
make new file at end of ptd with properties {name:newName}
end tell


set newFile to ((ptd as text) & newName) as alias
tell application "TextEdit"
activate
set Tithdr to File_item
make new document with properties {name:newName}
set text of document 1 to getpage
save document 1 in newFile
close document 1 without saving
delay 1
open newFile
end tell
end repeat

Here is the resulting event log :

tell current application
path to desktop
--> alias "Macintosh HD:Users:yvankoenig:Desktop:"
end tell
tell application "System Events"
make new file at end of alias "Macintosh HD:Users:yvankoenig:Desktop:" with properties {name:"FedMangrealtxt.rtf"}
--> file "Macintosh HD:Users:yvankoenig:Desktop:FedMangrealtxt.rtf"
end tell
tell application "TextEdit"
activate
make new document with properties {name:"FedMangrealtxt.rtf"}
--> document "FedMangrealtxt.rtf"
set every text of document 1 to "This is a test"
save document 1 in alias "Macintosh HD:Users:yvankoenig:Desktop:FedMangrealtxt.rtf"
close document 1 saving no
open alias "Macintosh HD:Users:yvankoenig:Desktop:FedMangrealtxt.rtf"
--> document "FedMangrealtxt.rtf"
end tell
tell application "System Events"
make new file at end of alias "Macintosh HD:Users:yvankoenig:Desktop:" with properties {name:"AmCentPosBal.rtf"}
--> file "Macintosh HD:Users:yvankoenig:Desktop:AmCentPosBal.rtf"
end tell
tell application "TextEdit"
activate
make new document with properties {name:"AmCentPosBal.rtf"}
--> document "AmCentPosBal.rtf"
set every text of document 1 to "This is a test"
save document 1 in alias "Macintosh HD:Users:yvankoenig:Desktop:AmCentPosBal.rtf"
close document 1 saving no
open alias "Macintosh HD:Users:yvankoenig:Desktop:AmCentPosBal.rtf"
--> document "AmCentPosBal.rtf"
end tell
tell application "System Events"
make new file at end of alias "Macintosh HD:Users:yvankoenig:Desktop:" with properties {name:"AmCentrealtxt.rtf"}
--> file "Macintosh HD:Users:yvankoenig:Desktop:AmCentrealtxt.rtf"
end tell
tell application "TextEdit"
activate
make new document with properties {name:"AmCentrealtxt.rtf"}
--> document "AmCentrealtxt.rtf"
set every text of document 1 to "This is a test"
save document 1 in alias "Macintosh HD:Users:yvankoenig:Desktop:AmCentrealtxt.rtf"
close document 1 saving no
open alias "Macintosh HD:Users:yvankoenig:Desktop:AmCentrealtxt.rtf"
--> document "AmCentrealtxt.rtf"
end tell

Résultat :

document "AmCentrealtxt.rtf" of application "TextEdit"


Yvan KOENIG (VALLAURIS, France) jeudi 24 janvier 2013 10:43:35




 _______________________________________________
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: TextEdit Save Problem (Thomas Maffucci)
      • From: Christopher Stone <email@hidden>
References: 
 >TextEdit Save Problem (Thomas Maffucci) (From: Thomas Maffucci <email@hidden>)
 >Re: TextEdit Save Problem (Thomas Maffucci) (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: TextEdit Save Problem (Thomas Maffucci)
  • Next by Date: TextEdit Save Problem (Thomas Maffucci)
  • Previous by thread: Re: TextEdit Save Problem (Thomas Maffucci)
  • Next by thread: Re: TextEdit Save Problem (Thomas Maffucci)
  • Index(es):
    • Date
    • Thread