Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > BBEdit Applescrtipt

BBEdit Applescrtipt
Thread Tools
Fresh-Faced Recruit
Join Date: Dec 2003
Status: Offline
Reply With Quote
Sep 7, 2004, 02:03 PM
 
Developers,

I know not a lot about applescript - i feel more at home with Java but i wrote a script a while ago with the help of a work colleague which said this:

<code>
tell BBedit

save document 1

end tell
</code>

Now that BBEdit has a new Interface i need to modufy the script so that the document i am editing is saved and not the first document in BBEdits list.

What i want to know is where the function definition is for "save" - or API for save.

I looked in BBEdit dictionary - i figured out the method call i was interedted in - but i couldnt figure out how to create a new save script.

Thanks




save document 1


to change to

save active document of text windows

???
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Sep 8, 2004, 03:14 PM
 
Code:
tell application "BBedit" save front document end tell
Craig
     
Fresh-Faced Recruit
Join Date: Dec 2003
Status: Offline
Reply With Quote
Sep 8, 2004, 03:21 PM
 
Craig,

Thats wrong!

I have a document open at any time which might have many document sopen inside it. That snippet of code you sent saves the first document in the front window - If i am editing the fourth docuemnt in the current window this wont work.

BTW: theres a bit more to the Applescript then just saving - I wanted to get saving done as the other pieces i can figure out. - Thanks

And if you dont mind - where is the function definition of save? - and the arguments it takes?

Thanks
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Sep 8, 2004, 07:06 PM
 
I'm not following your question correctly. With BBEdit 8 you can have more than one document per window by using the Documents Drawer and Nav bar. If you are editing a document, that document is in the front window.For this example assume the document has been previously saved, you have made changes to it, and it is active.
Code:
Tell application "BBEdit" set activeDocName to name of front window save text document activeDocName end Tell
Applescript provides a scripting machanism for Apple Events. Applescript commands are verbs that apply to Apple's object model and are not object methods. The Save Event is in the Standard Suite which is a part of BBEdit's dictionary. Applescript's classes are object-like but do not follow all OOP criteria.

Here is the link to Apple's overview of Applescript. Take a look at the Applescript Language Reference link as well.

HTH
Craig
(Last edited by suthercd; Sep 8, 2004 at 07:12 PM. )
     
Fresh-Faced Recruit
Join Date: Dec 2003
Status: Offline
Reply With Quote
Sep 11, 2004, 12:02 PM
 
Thank you Craig - that worked - I owe you one.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:13 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2