As object, can Finder change visibility of a file? I’ve googled but I have find only visible yes/not of a window, element, etc… nothing regarding a file.
So I’ve tried this
(* this_item is a file or folder fo my user *)
tell application "Finder" to set visible of this_item to false
But it gives me an error
(* this_item is a file or folder fo my user *)
set visible of ithis_item to true
visible is a property of file info (in Standard Additions) but it is “get” only. “Invisibles” from a system perspective are files whose names begin with a period, like “.DS_Store”
display dialog "Set the visibility of hidden files..." buttons {"Cancel", "Visible", "Invisible"} default button 1
copy the result as list to {buttonpressed}
if the buttonpressed is "Invisible" then
try
tell application "Finder" to quit
do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
delay 1
tell application "Finder" to activate
end try
else if the buttonpressed is "Visible" then
try
tell application "Finder" to quit
do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
delay 1
tell application "Finder" to activate
end try
end if
Hi Mikey-San.
Thanx for tips. I’ve cecked the SetFile utility: it appears right as I ask.
Here the solution
(* SetFile utility is under the dropplet, and this_item is the item: item is visible and goes invisible *)
set SetFile to the quoted form of POSIX path of (path to resource "SetFile")
set t_item to the quoted form of POSIX path of this_item
do shell script (SetFile & space & "-a V" & space & t_item)
or
(* SetFile utility is under the dropplet, and this_item is the item: item is visible and goes invisible *)
set SetFile to the quoted form of POSIX path of (path to resource "SetFile")
set t_item to the quoted form of POSIX path of this_item
do shell script (SetFile & space & "-a v" & space & t_item)