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):||3 October 2014|
|PDF File Size:||17.37 Mb|
|ePub File Size:||4.37 Mb|
|Price:||Free* [*Free Regsitration Required]|
AppleScript, new doc in TextEdit, serious error with permissions on doc I apologize for the length of this question. This folder will now be accessible in any Finder window.
Hi, I applrscript like the proper way. On both my machines Tiger and JaguarTE ignores everything except the preference setting. Optionally create a folder named “Notes” — mine is inside my Documents folder. I had started from the point at which all of your documents were already open. I guess the answer is going to be something like “create the file with a specific path so you know where it is going”, but it still bothers me. Regarding the second script, it’s not closed.
My minor addition to your code deals wth this fact, but of course there may be better ways to do what you want. The problem with this code is that, if I have any other TextEdit files open, the code will also bring the other documents to the front as well. 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.
When saving, be sure and de-select the “Startup screen” option. In your scenario, it’s almost certain that Option 2 applies. So, unless you want the windows closed, minimised or hidden, they will be visible.
Post as a guest Name. Don’t understand how yours works and mine doesn’t. May 29, 6: Drag the icon of the compiled app to the toolbar of the Finder window. Nano 7 – backgrounds I replied too fast. Be careful using this version because I set it to quit without saving any open documents if TextEdit was already running.
The functionality of this script is now available in every Finder window. I pasted the script into script editor and saved as application. Click here for complete coverage of Lion on Macworld.
What’s New in the Forums?
How can I use AppleScript to tell TextEdit to attach a file? – Ask Different
Monomeeth I may not be dave the correct terminology. It was just that you said, “TextEdit was running, but it was hidden therefore all windows are hidden.
Right-clicking on the TextEdit icon in the Dock and selecting “Show All Windows” doesn’t bring the invisible windows forward either. Visit other IDG sites: But by far the biggest advantage of a good dedicated app is sync across several computers.
TM backup via Ethernet.
Applescript open file with TextEdit and export them as pdf – Stack Overflow
So I’m hoping this will attract search hits beyond people participating in this community. I am aware of the a;plescript mailing list, and I’ll probably post a much briefer version of this, but I think there’s more here than just a direct AppleScript question. 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. I haven’t tested the answer by Mockman, but it may also be a good solution.
However I personally don’t use the script menu for this script. Regardless of how TextEdit was hidden from view, whenever it is brought to the foreground again, all its windows become visible unless they’re minimisedand that’s what is happening when your script runs. Sign up or log in Sign up using Google. Sign up using Facebook.
Search Advanced From our Sponsor It’s also faster to summon than using AppleScript. Make your gloves touchscreen friendly Apple?
Simple Applescript: Create a .txt file
TE really is defective, in my view. Seems a little weird though. Murali [ Reply to This ]. 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. I’ve also tested with and without adding a delay command before the tell newDoc block to insure newDoc was ready to accept the attachment.
The only way I can think of at present to achieve what you want in a practical way is to ensure that your script minimises all other windows except for the one it’s just opened. Saving lots of these files manually is a chore, so I created an AppleScript to take care of this. And yet another is exactly what you’ve just described in your comment – that it was hidden because other applications and their windows Preview.