Save as different types?

How would I make a save dialog with the choice for two different file types?
Ex: in Script Editor you can save as a script or application.

I’m sure this is pretty close to it:

set savepath to choose file name with prompt "Save As..." default name "untitled.cpp"

either make a window in IB to do that, or have a diaolg before that .
eg:

set ext to button returned of (display dialog "What extension do you want?" buttons {".cpp", ".blah"} default button 2)
set savepath to choose file name with prompt "Save As..." default name "untitled" & ext

ah that makes sense :cool:.

Thanks! :smiley:

If you are working with a document-based ASS app, you can add document types to your project. Under the “Projects” menu, near the bottom is a menu item: Edit Active Target ‘target name’. This will display a window allowing you to edit various aspects of your project including document types. On the left side, locate: Info.plists Entries / Simple View / Document types. From here, on the right hand side you can add document types to your project. Afterward, when the save dialog is displayed a pop-up button (or menu, if forget which) is automatically added to the dialog for you.

Hope this helps,
Brad Bumgarner, CTA

o ok, thanks again! :lol:

It didnt work

I don’t know if this makes a difference or not, but when I set up a doc-based ASS app, I used “write to file” and “read from file” handlers instead of the data representation handlers.

I have 2 versions of any app that I started about 6 months ago. Both versions have multiple document types defined. The version that uses the “write to file/read from file” handlers displays the pop-up in the save panel. The version that uses the data representation handlers does not. Granted I haven’t worked on these particular apps in about 5 months so I don’t remember the details of why I used the different handlers. It could very well be that I used the data representation handler (in the 2nd version) as a temporary measure until I had the rest of the code working the way it’s supposed to.

Brad Bumgarner, CTA

If you’re using an AS-S app, you can try using display save panel.