Saturday, December 16, 2017

#1 2005-10-12 02:26:38 pm

julifos
Administrator
From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

Is it possible to change the visibility of a file with AppleScript?

Yes.

Under OS X, you can use the command-line utility SetFile, installed with the Developer Tools. Eg:

Applescript:

do shell script "/Developer/Tools/SetFile -a V /path/to/file.txt"

Simply changing "-a V" to "-a v" will make the file visible again.

Under OS 9 and back it is possible to change a file's visibility with AppleScript but a third party scripting addition (osax) will be needed. The Akua Sweets and File Visibility scripting additions both offer this capability.

To search, browse and download a wide variety of scripting additions which are available.

Example Script:
Using Akua Sweets, this script will toggle visibility of a file "theFile" from on to off or off to on:

Applescript:

set extInfo to extended info for theFile
set invisStatus to invisible status of extInfo -- i.e. true or false
set invisible status of extInfo to (not invisStatus) -- opposite
apply catalog info extInfo to theFile

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)