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.
|Published (Last):||25 March 2004|
|PDF File Size:||2.48 Mb|
|ePub File Size:||3.74 Mb|
|Price:||Free* [*Free Regsitration Required]|
May 29, 8: Optionally create a folder named “Notes” — mine is inside my Documents folder. Hi, I don’t like the proper way. The script stops without warning after opening the files.
How can I use AppleScript to tell TextEdit to attach a file? – Ask Different
All replies Drop Down menu. Post as a guest Name. I’m not quite getting what the issue is here – maybe I need another coffee! I am aware of the applescript-users mailing list, and I’ll probably post a much briefer version of this, but I think there’s more here applescriot just a direct AppleScript question.
So, unless you want the windows closed, minimised or hidden, they will be visible.
Simple Applescript: Create a .txt file
BluesPower on Jan 17, ’10 User applesccript for user: 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 or file specifier as the destination.
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. Hopefully this works for you – but if not maybe someone else swve up with a better solution.
When I remove the activate line from the code: The files either contain plain text or text with RTF formatting tags. Some applications protect you from yourself in this respect; TextEdit apparently not. The reason that no TextEdit windows are visible in my first screenshot is because a different application i. Do you want your script to run and then hide all the other TextEdit windows, or do you want it to mnimise all the other TextEdit windows instead?
Thanks, as always, Nigel. If I select multiple music files, it produces multiple TextEdit files on my desktop – all good.
Email Required, but never shown. I can’t get either of these solutions ss work correctly. Savw is not the case. Atom spplescript feed Powered by FluxBB. 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. There’s only three possibilities:. 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: Ask a question Reset.
Also, I use Mission Control, so it is entirely possible for me to have, for example, two TextEdit windows in front of a window of a different app, and two TextEdit windows hidden behind that window.
I texhedit consider it a bit of a bug that TE’s warning buttons don’t work — no matter what apolescript select, Overwrite or Don’t Overwrite it overwrites! I also figured out long ago that the best way to keep notes is the finder and spotlight, and it’s better than any note keeping app, at least for me.
Search Advanced From our Sponsor For example, you could achieve this with the following code:. Here is the script: What’s the proper way to save this TextEdit Doc as rtf on my desktop? Apple gets what it pays for Review: I’m sure that there are other methods to identify the windows.
Anyway, I said thanks, and asked why the close and reopen?