ChooseFileDialog - Wishlist

ChooseFileDialog is a terrific feature considering all the options that can be invoked. So, in the spirit of never having enough, I’d like to see one more option. That would be the option to include a New Folder button, as there is in the savefiledialog.

Unfortunately, this dialog is an Apple dialog. All of the options in this statement are simply passed thru to Apple’s code, and Apple doesn’t provide an option button for New Folder.

I actually think this is a sensible design decision on Apple’s part. This dialog is intended for choosing an existing file. If you create a new folder, it won’t have any files to select in it, so a New Folder button doesn’t really make any sense.

It does make sense in the Save File dialog, because in that case you could create a new folder to place the new file into. So Apple did include the New Folder button in that dialog.

On the other hand, it is possible to configure the Choose File dialog to allow selections of folders, so I guess in that case a New Folder button could make sense, you could create a folder and then immediately select it. But there is no way for ProVUE to add this – you would have to convince someone at Apple to do so. Needless to say, I think this is very unlikely.

It would be a lot of work, but you could use a form and a Text List to make your own “faux” Choose File dialog. I don’t think you would ever get it to exactly match Apple’s dialog (and it wouldn’t work with 3rd party programs like Default Folder), but that’s the only way it could be done. Of course ProVUE could also take this approach but it’s my policy to never build duplicates of Apple features. I believe it is better to accept the limitations Apple imposes but maintain 100% macOS compatibility.

Precisely my objective. But since my wish cannot be your command I’ll manage.

Actually third party programs, including at least Default Folder can offer a way to make new folders within Panorama’s ChooseFileDialog. It’s not identical to what Apple, and thus PanX, offer for SaveFileDialogs, but the option exists if you are willing to accept the rest of the interface changes it makes.

I suspect Jim is making a database for someone else, so he can’t count on something like Default Folder being installed. But that’s a good suggestion. I just tried it, if. you have Default Folder then you can click on the Utility icon and choose New Folder from the popup menu.

CleanShot 2023-03-23 at 21.17.43@2x

In general, Default Folder is a pretty great add-on for macOS. It hasn’t been around quite as long as Panorama, but close.

If the New Folder option needs to be there, but it all has to be implemented in PanoramaX code I think something along this line is possible:
Start with some dialog asking “Save in existing or new folder?”. If former proceed to SaveDialog. If latter branch to ChoseFileDialog. Set folders option to true() and file types to “” so they can only select folders, but will have the button to make new ones. Then take the path that outputs and plug it into initialpath option of SaveDialog. It’s neither as elegant as his wish nor as Default Folder but it offers the option yet minimizes needed user input.

The following AppleScript will open a dialog with a New Folder button.

set thisFolder to POSIX path of (choose folder)

Here is the documentation from the StandardAdditions dictionary.

choose folder v : Choose a folder on a disk or server

choose folder

[with prompt text] : the prompt to be displayed in the dialog box

[default location alias] : the default folder location

[invisibles boolean] : Show invisible files and folders? (default is false)

[multiple selections allowed boolean] : Allow multiple items to be selected? (default is false)

[showing package contents boolean] : Show the contents of packages? (Packages will be treated as folders. Default is false.)

→ alias : the chosen folder

Thanks to all of you for your input. I need to review it all and see what will best fit my scheme. The AppleScript looks promising.

I’ve built a procedure that uses a shell script to do screenshots of charts, since they won’t print. They’re in a well defined area within the form so a click on a camera icon instantly saves a png or pdf of the targeted area.

My objective with the folder is to allow the user to pick a destination in lieu of the desktop; the default. Until they change it, that’ll be the place all screenshots go until they change it or Quit Panorama. So I want them to either choose a folder, or create one and then choose that.

Is the user going to directly manipulate the PNG or PDF file?

If what you really want is to print, I would suggest saving the screenshot to the temporary folder. Then you could open a form that displays the saved image, and print that. Then you could either delete the image, or just wait 3 days and the system will delete the image file for you.

Apple sets up a temporary folder for each user that programs can use for anonymous files they want to save for a short period of time. This folder is invisible (well, it can be made visible but it’s quite difficult). Files put into this folder will be deleted automatically after 3 days, though it’s still a good idea to delete them once you’ve finished with them if you know when you’re finished with them. Panorama has a function that tells you where the temporary folder is (note that this is not the same on all computers).

Note that you can create a folder inside the temp folder, you might want to create a specific folder for your screenshots. Then you just have to create a unique name for each file, the timestampstr( function is handy for that sort of thing.

I think this would allow you to implement this without ever bothering the user for a folder location.

The temp folder info is very helpful for some scenarios. One of the processes involving the screenshots, creates one chart and matrix after another and saves a PDF screenshot of each. Depending on the report being created, it may be a couple or it may be 20+ pages. Once they’re all created I have a Python script combine them into a single PDF document. Panorama deletes the individual PDFs when the overall task is completed.

At present this is all saved into a very visible folder where the user has opportunity to interfere. Using the Temp folder would be a tad cleaner.