Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI TextEdit



On 2007-06-01, at 23:23:32, Michelle Steiner wrote:

On Jun 1, 2007, at 11:21 PM, Rick Gordon wrote:

Why not just forget the System Events, and tell document 1 to save as "HTML"

From TexttEdit's dictionary:

save v : Save an object.
        save reference : the object for the command
             [as Unicode text] : The file type in which to save the data.
            [in alias] : The file in which to save the object.

Did you try it?  I couldn't get it to work.

The problems I had with this script is that it seemed to run too fast for TE to handle. So I had to pepper it with calls to 'delay'. Also, if I pressed Cmd-R in Script Editor, then sometimes it was like the keystroke carried over to TE and again messed things up.

on TESaveAs(theKind, theTitle)
tell application "TextEdit" to activate
tell application "System Events" to tell application process "TextEdit" to tell window 1
keystroke "s" using {command down, shift down}
tell sheet 1
keystroke theTitle
delay 1
tell group 1 to tell pop up button 1
click
click menu item theKind of menu 1
delay 1
end tell
click button "Save"
end tell
end tell
end TESaveAs

TESaveAs("HTML", "Acme-Sales-2007-05")


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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >GUI TextEdit (From: Michael Ghilissen <email@hidden>)
 >RE: GUI TextEdit (From: Rick Gordon <email@hidden>)
 >Re: GUI TextEdit (From: Michelle Steiner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.