Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • It works great. I found a minor issue, though. If the user supplies a name that contains a space, the AppleScript will give an error. So, you have to add set filepath to quoted form of filepath in your code to fix this. Also, if TextEdit does not have the black dot underneath its logo in the Dock, about 1 in every 10 times that I run your script, the cursor is not moved to the second line. Instead, as the file opens, I hear a beep and the cursor remains on the first line. Do you think that the code should contain a delay above the final line, to prevent this issue? Commented Jan 29, 2017 at 5:25
  • Also, can you modify your code so that the TextEdit window that is opened has bounds of {160, 10, 883, 639}? Is tell application "TextEdit" to set bounds of front window to {160, 10, 883, 639} as the final line the best way to do this? Thank you. Commented Jan 29, 2017 at 5:45
  • @oa-, Aside from the fact that it's malformed, just what exactly is do shell script "head -n 9 r" & filename & ".rtf" & " >> " & filename & ".rtf" & filepath & " | cut -d ' ' -f 1" supposed to be doing!? Why does it even need to be a part of the script? Commented Jan 31, 2017 at 20:00
  • @rubik'ssphere Thanks for the hint regarding the file name. Yes, changing the delay to 2 or 3 seconds should fix it. Commented Feb 1, 2017 at 9:25
  • @rubik'ssphere Yes, setting the bounds with your code seems alright to me. Commented Feb 1, 2017 at 9:25