• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Text file timeout save and close
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text file timeout save and close


  • Subject: Text file timeout save and close
  • From: "Ken G. Brown" <email@hidden>
  • Date: Mon, 6 Aug 2007 10:36:50 -0600

Hi,
I'm new to TextWrangler scripting. I see from some messages in the TextWrangler archives that BBedit is quite similar.
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 specified 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 G. Brown
 _______________________________________________
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

  • Follow-Ups:
    • Re: Text file timeout save and close
      • From: "Gary (Lists)" <email@hidden>
  • Prev by Date: Re: GUI Scripting to click on "Detect Displays"
  • Next by Date: Re: Acrobat GUI scripting query...
  • Previous by thread: Re: i want to delete all files and folders that are unlabeled
  • Next by thread: Re: Text file timeout save and close
  • Index(es):
    • Date
    • Thread