detecting visibilty

Hi to this forum

a couple of weeks I started reading the missing manual of AppleScript, but “some” things are still sliiiightly unclear.

Tonight I tried to write a simple script that can change the visibilty of my finder files by using the respective shell script.

I was able to at least create two scripts: one that makes the files invisible and on doing the opposite.

But I would like tp have just a single one.

In order to achieve this I somehow need to determine the state of visibility.

And THAT’S exactly the point i cannot solve.

I hope anyone could help me out a bit.

All the best

joh

Hi,

take a look at this thread

Hi Stefan,

thanks for the very quick reply. I was used to such quickness in my usual mac forum, but to find it anywhere else…

Thanks for that.

And for the link. That was exactly the script i was trying to write, but it’s too early yet.

Together with spark, a VERY useful daemon, I can set up a shortcut for this script and my life’s much easier.

Thank again

joh

joh, I would change James Nierodzik’s first script to this…

set state to do shell script "defaults read com.apple.finder AppleShowAllFiles"

if state is not "Yes" then
	quit application "Finder"
	do shell script "defaults write com.apple.Finder AppleShowAllFiles Yes" -- ;KillAll Finder;"
	delay 0.25
	launch application "Finder"
else
	quit application "Finder"
	do shell script "defaults write com.apple.Finder AppleShowAllFiles No" -- ;KillAll Finder;"
	delay 0.25
	launch application "Finder"
end if

The reason for the change is that if you use ;KillAll Finder; the folder(s) you have open will close.
Using quit application “Finder” then a short delay with launch application “Finder” the folder(s) should stay open (they do for me).
Just my 2 cents. :smiley:

Tom