if folder is there, show button

Is there a way to have a button only appear when A folder is present? (path givin)

So like

 if folder is there
then show button
else hide
end if

Hi There,

Try this


	set theFolder to "Path:To:Folder"
	tell application "Finder"
		if exists folder theFolder then
			set itExists to true
		else
			set itExists to false
		end if
	end tell
	if itExists is true then
		set visible of button "button" of window 1 to true
	else
		set visible of button "button" of window 1 to false
	end if


Sorry Dallas, I can’t resist to optimize long-winded scripts :wink:


set theFolder to "Path:To:Folder"
tell application "Finder" to set itExists to exists folder theFolder
set visible of button "button" of window 1 to itExists

Nice work Stefan,

That’s what it is all about, see now I have learned something to.

Nope. But if u were to know how to (disable) the button, then maybe that’d work. I mean, if the folder isn’t there, then i’m suppose to have a button overlapping it?

I’m not sure what you are asking for, the code supplied by Stefan and I is exactly what you asked for in your original post. If you want to just enable and disable a button simply switch the word “visible” for “enabled”.