Hi,
I'm new to TextWrangler scripting. I see from some messages in the TextWrangler 
archives that BBedit is quite similar so am posting here as well, just in case.
I want to have a script tell TextWrangler to open a specified file, add a 
timestamp to the beginning followed by a couple of blank lines, and position 
the insertion point so the user can enter some stuff immediately after the 
timestamp.

This almost does what I want.

tell application "TextWrangler"
        activate
        open (file named thisCommentFile)
        set myTimeStamp to current date
        tell front document
                set text 1 to (("-- " & myTimeStamp as string) & " --" & return 
& return & return) & (text 1)
                tell text 1
                        select insertion point before line 2
                end tell
                set bounds of front window to {550, 216, 950, 680}
        end tell
end tell

However, in the case that the user starts to enter some info, then gets 
interrupted and goes away, I would like the file to automatically save and 
close after a few minutes with no text entry activity, thereby saving the 
already entered info to that point.

I tried delaying after the open, but that has the side effect of not being able 
to run the script again before it has completed the timeout delay. In the case 
that the timeout save and close has not yet occurred and the user runs the same 
file open script again, I just want the already opened file to pop to the front.

So the question is, how can the save and close timeout be implemented?

Thx for any help.

Ken

-- 
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to