Try this:

-- begin script --
set SourceFolderPath to choose folder with prompt "Format HTML files of which folder?"

tell application "Finder"
        try
set FilesList to ((every file of entire contents of folder SourceFolderPath whose name ends with ".html") as alias) as list
        on error number -1700 from f
-- for >1 files trick the finder by getting an alias list of the files from the error message:
                set FilesList to f as list
        end try
end tell

tell application "BBEdit"
        activate
        repeat with i from 1 to count FilesList
                open (item i of FilesList)
                tell text document 1
                        optimize
                        close saving yes
                end tell
        end repeat
end tell
-- end script --


--
Greg Raven
Apple Valley, CA

Election 2006 -- Visit this site to see each candidate's stand on illegal immigration:

http://www.betterimmigration.com/candidates/2006/featuredraces.html


On Jun 14, 2006, at 1:30 PM, Michael Heth wrote:



Hiya,

I was very glad to see the optimize command in the menus on my 8.0 upgrade. It might have been there before and I missed it but since I had been doing this type of optimization manually since about 1996 it great to see one command that would strip out all the tabs/ crs/excess spaces etc.

But I tried to make a small applescript to pull down the menu to choose optimize in the hopes of automating it to work on whole folders but did not get anywhere.

Is the optimize command one that I can applescript? Am I missing something?

Thanks for any info.

Michael Heth

--
------------------------------------------------------------------
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_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>



--
------------------------------------------------------------------
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_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to