Poking around in AppleScript shows that the new document’s path is After editing the file the first time I try to save the file I get the above error. tell application “TextEdit” activate make new document set theDate to current date set text of document 1 to theDate as text save document 1 in. TextEdit was running, but it was hidden (therefore all windows are hidden). This just means you hid TextEdit from view. Running your script.

Author: Goshakar Torn
Country: Uzbekistan
Language: English (Spanish)
Genre: Career
Published (Last): 19 May 2007
Pages: 330
PDF File Size: 20.1 Mb
ePub File Size: 3.79 Mb
ISBN: 937-7-40482-904-4
Downloads: 11521
Price: Free* [*Free Regsitration Required]
Uploader: Voodoorg

It definitely does not happen when the document is created with the initial text, just when an attempt is made to modify it — sometimes the attempt succeeds but the file still can’t be close or saved. However, the script can close the document after it has gotten into this weird state by simply doing close doc without saving After editing the file the first time I try to save the file I get the above error message.

It was just that you said, “TextEdit was running, but it was hidden therefore all windows are hidden. Without the close and reopen, it doesn’t seem possible to save the subsequent changes to the text. The ‘save’ paradigm with any application is that you’re saving a document to a file, not a file to a folder, so you have to specify a file path sabe file specifier as the destination. The script stops without warning after opening the files.


Simple Applescript: Create a .txt file

All replies Drop Down menu. I haven’t tested the answer by Mockman, but it may also be a good solution. But only you can decide which one, if any, suits you. You may need to adjust the delay settings in the AppleScript code a little bit. How it works is it takes the first paragraph a line followed by return of the document — typically the title in my writing — and uses this to name the text file note some characters like ‘: There’s only three possibilities: BluesPower on Jan 17, ’10 If I select multiple music files, it produces multiple TextEdit files on my desktop – all good.

AppleScript, new doc in TextEdit, serious… – Apple Community

I can’t get either of these solutions to work correctly. My preferred solution is that this one file comes to the foreground and the other TextEdit windows that are currently in the background when the script is triggered remain where they are in the background. The following AppleScript is the farthest I’ve been able to get; it does not produce errors when run, but it also does not attach a file:.

What’s the proper way to save this TextEdit Doc as rtf on my desktop?

Regards, Michael [ Reply to This ]. Optionally create a folder named “Notes” — mine is inside my Documents folder. One of my attempts reported in bugs actually erased my desktop folder.

When I make a new TextEdit file through it’s menu the document isn’t anywhere, certainly not where the script’s doc sometimes ends up.


Please see the screenshots that I’ve added to my post. I often dump ideas, questions, and answers in TextEdit files which I later use Spotlight to retrieve. Or are you wanting to actually change the way applications behave in macOS e.

Please see the revised post.

You could also do something like this… where a list of windows from the second to the last is used. I can recommend Smultron payment requested or Yojimbo commericalwhich also has good provisions to store serial numbers, passwords, etc.

At one point I thought maybe that key was setting set theFile to outside of the tell application “TextEdit” block but that svae not an absolute.

What’s New in the Forums? I hate this Containers nonsense — if you go into one of those folders, most of the time you’ll see links back yextedit your top-level folders and no evidence of anything useful, and sometimes I think they cache stuff you are trying to sxve there. I’m not sure if I made it clear in my script that one of the “Either: May 30, 8: Whether the window is currently visible.

And yet another is exactly what you’ve just described in your comment – that it was hidden because other applications and their windows Preview.