Hi folks, I wish I was smarter with AppleScript. OR, I wish Appelscript could be a little more clear … oh well.
I need help, please. I want to paste a replaced line into the Script editor. But I can not find an example anywhere. This is something I wrote so that I could keep adding changes to my spell checking in Mailsmith. After running a script that puts up a new line with replace… example, I want the script to open the script editor (the file is already open or it will hang indefinitely).
I want to paste the results into the end of the file but of course “end tell” is already at the end. So, I need to “find” the line “end tell” and replace it with what I am pasting (adding my own “end tell” to the pasted text)
Or, I need to learn how to insert text. It appears this can be done, but I sure cant find a clear example of how it can be done.
Thanks for any help.
tell application "Script Editor"
activate
tell front document
set newtextpaste to contents
set contents to newtextpaste & return & return & newaddition
-- Good to this point, but it pastes after the "end tell" so it wont compile or save.
-- here newaddition contains the added replace line with the newly added and corrected misspelling.
-- does not work (trial and error here folks): find selection contains "end tell" does not work (trial and error here folks)
-- - does not work (trial and error here folks): searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
-- save (This should work but I have it taken out until I get it figured out)
end tell
end tell