choose file with prompt shows hidden files

I have written a script which uploads a chosen file to our ‘live’ webserveer using Interarchy. However, when I issue the following command:

choose file with prompt

The listing includes hidden folders and files. How can I hide these files from my dialog?

Hi :wink:
Try :

tell application "Finder" to (choose file)

:wink:

Using the Finder won’t help. You have to pass the call a list of file types to limit the search. The list can be a single file type or a group, e.g.:

Jon

Well, I can’t do exactly that, but here is a snippet of the code that I do have.


	tell application "Finder"
		set theItem to (choose file with prompt "Choose a file from the Primary website to upload:") as string
	end tell

For some reason, if I paste your code into a new Script Editor document and run, I still get the hidden files showing up? :?

If you want to use built-in OS X commands, I’ve got a cURL FTP-upload handler that may be helpful.

Actually, you must have a utility (TinkTools, perhaps, in your System Prefs?) that forces all hidden files and folders to be displayed. The choose file dialog box hides them by default.

Not on my System the “Choose file” command has always shown everything in the dialog window that comes up.

Krioni,

I’m afraid I don’t have tinkertool installed, and hidden files are not showing up anywhere else.

Also, I am relctuant to limit the file types because there are many types of files I wish to upload; html, asp, exe, flash swf, gif, jpeg, png, doc, xls, pdf etc. I have read I can only restrict the list to a maximum of four file types.

Many thanks for your suggestions though everyone. :smiley:

Hi,

If you have the Satimage osax scripting addition:

http://www.satimage.fr/software/en/softx.html#smile

then you can use ‘navchoose object’.

gl,

It seems that I was mistaken when I said there was a limit of 4 file types that could be defined. So I updated my original code to include as many filetypes I could think of that I might possiby need to upload.


if user_choice is "file" then
	set theItem to (choose file with prompt "Choose a file from the Primary website to upload:" of type {"    ", "TEXT", "JPEG", "PDF ", "GIFf", "SLD8", "W8BN", "XLS8", "ZIP ", "BINA"}) as string

The first type is four spaces because files which are downloaded via FTP often lose their Macintosh filetype and creator information. So now I have a very handy little util that uploads files on my Mac to the correct location on the Webserver, without having all those ugly and useless hidden files showing up in my dialog box.

Once again, many thanks for your help on this, everyone.

You may also want to add “???” which sometimes appears as a file type for files that lose their file types in transit. I’ve also used this file type: ((ASCII character 0) & (ASCII character 0) & (ASCII character 0) & (ASCII character 0)) for “.plist” files and others. You usually can’t copy and paste this one but using the “ASCII character” call works.

Apple really needs to update choose file to have an additional optional parameter list of “file extension” since they’ve turned their back on the resource fork.

Jon