• 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
Re: GUI TextEdit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI TextEdit


  • Subject: Re: GUI TextEdit
  • From: Philip Aker <email@hidden>
  • Date: Sun, 3 Jun 2007 04:06:42 -0700

On 2007-06-03, at 01:11:46, KOENIG Yvan wrote:

Just see what happens when Acme-Sales-2007-05.html already exists. Kinda short on time for today but I'll see about a solution for tomorrow.


Can't you test if the html file already exists?
If it does, rename it something like Acme-Sales-2007-05-old.html

What a mess. All this because TE can't handle 'save' properly.

on TESaveAs(theKind, theTitle, theExtension)
set p to ""
tell application "TextEdit"
activate
if exists (path of document 1) then
set p to (do shell script "dirname " & path of document 1) & "/" & theTitle & "." & theExtension
end if
end tell
if (p is not "") then
set f to POSIX file p
tell application "Finder"
if exists f then delete f
end tell
end if
tell application "System Events" to tell application process "TextEdit" to tell window 1
keystroke "s" using {command down, shift down}
repeat until (sheet 1 exists)
delay 0.2
end repeat
tell sheet 1
set value of text field 1 to theTitle
tell group 1 to tell pop up button 1
click
repeat until (menu 1 exists)
delay 0.2
end repeat
click menu item theKind of menu 1
repeat while (menu 1 exists)
delay 0.2
end repeat
end tell
click button "Save"
end tell
end tell
end TESaveAs
TESaveAs("HTML", "Acme-Sales-2007-05", "html")



Philip Aker
email@hidden



 _______________________________________________
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

References: 
 >Re: GUI TextEdit (From: "Nigel Garvey" <email@hidden>)
 >Re: GUI TextEdit (From: Philip Aker <email@hidden>)
 >Re: GUI TextEdit (From: "Nigel Garvey" <email@hidden>)
 >Re: GUI TextEdit (From: Philip Aker <email@hidden>)
 >Re: GUI TextEdit (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: GUI TextEdit
  • Next by Date: Re: Searching a Mail message
  • Previous by thread: Re: GUI TextEdit
  • Next by thread: list-building performance
  • Index(es):
    • Date
    • Thread