What's the correct way to insert text into a script at the current insertion point?
What's the correct way to insert text into a script at the current insertion point?
- Subject: What's the correct way to insert text into a script at the current insertion point?
- From: Jim Brandt <email@hidden>
- Date: Fri, 9 Apr 2010 13:08:23 -0500
What's the correct way to insert text (using a script) into a script
at the current insertion point? I've tried this script:
set dd_mmm_yyyy to (do shell script ("date \"+%e-%b-%Y\"") as text)
tell application "Script Editor"
tell front document
set the selected_text to contents of selection
if the selected_text is "" then
copy dd_mmm_yyyy to before insertion point
else
set contents of selection to dd_mmm_yyyy
end if
end tell
end tell
If something is selected, the script works.
If something is not selected, all I get is a beep. Since it's the
script editor I'm trying to script, I can't run this with a log
going, so I can't see what the error is.
So what is the accepted way to copy text to any text-based editor at
the current insertion point?
For the record, I've looked at the various scripts written for the
Script Editor that Apple supplies. They seem overly complicated and
hard to understand.
TIA,
Jim Brandt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden