On Oct 28, 2012, at 7:51 AM, dweinberger wrote:

> Sure. This is what recording the events generates:
> 
> tell application "BBEdit"
>     activate
>     open {file "Macintosh 
> HD:Users:weinbergerd:Dropbox:temp:convertedMarkdown.html"} with LF translation
> end tell

Thanks. I'm no AppleScript expert but I think you're right on your assumption 
that the export feature is not (yet) recordable. That said, I'll bet it's in 
the BBEdit AS dictionary (open ScriptEditor and select File->Open Dictionary, 
and then select BBEdit from the resulting menu to find the following):

export v : Export an object
export [specifier] : object to export
[to alias] : where to save the exported data

which, as AS would be something like this:

tell application "BBEdit"
        activate
        set fileAsMD to document 1 of window 1
        set fileAsHTML to "Macintosh 
HD:Users:weinbergerd:Dropbox:temp:convertedMarkdown.html" as alias
        export fileAsMD to fileAsHTML
end tell

To make this portable/flexible you need to set some other variables or 
parameters. The name property of the document object doesn't seem to expose the 
extension so not sure how to handle that, otherwise the script could be as easy 
as the one shown below. Maybe someone with more AppleScript experience could 
chime in.

(NB: The following script WILL NOT WORK but should provide you with ideas on 
how to make it work)

tell application "BBEdit"
        activate
        set fileAsMD to document 1 of window 1
        set myFileName to the name of fileAsMD
        set myFileName to the basename of myFileName
        set fileAsHTML to "Macintosh HD:Users:weinbergerd:Dropbox:temp:" & 
myFileName & ".html" as alias
        export fileAsMD to fileAsHTML
end tell



And speaking of example scripts... Have you searched for scripts that maybe 
already do what you're trying to do and then modify them? Sometimes that's the 
shortest distance between two points.

My 2¢

Ted

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to