Re: tell app, name in string var
Re: tell app, name in string var
- Subject: Re: tell app, name in string var
- From: Jon Pugh <email@hidden>
- Date: Fri, 27 May 2011 18:21:07 -0700
At 6:21 PM -0600 5/27/11, Doug McNutt wrote:
>Finder is an Apple invention that deliberately obscures files that DO EXIST.
No argument can be made here, you are entirely correct.
>"It's UNIX underneath. That makes it better than Classic." But we really don't really want you to use the UNIX tools.
"We don't want you to need to use the Unix tools."
Note that Terminal ships with every Mac. You can run Unix apps and Unix scripts, just not from the Finder. Its job is to provide a beginner to advanced level of access to your computer. Not expert level access. There have been a few Finder replacements over the years.
http://www.lmgtfy.com/?q=finder+replacement
However, the Finder is generally capable with the caveat that it doesn't cope well with changes to file system visibility indicators. I suspect this is because it is currently a mismash of rules.
First off, we have the traditional HFS FinderInfo flag bit, which is on for Invisible and off normally. Setting this will make a file disappear.
-- turn Finder selected items invisible
tell application "Finder"
set selectedFiles to selection
repeat with f in selectedFiles
set g to f as string
set g to POSIX path of g
set g to quoted form of g
do shell script "/usr/bin/SetFile -a V " & g
end repeat
end tell
-- building in undo is left as an exercise for the reader
Second, the Unix convention of naming the file "." something. Note that these types of names were illegal on the Classic Mac due to the way it named drivers. I've encountered Mac programs which just couldn't write files with a leading period. Nevertheless, the Finder obeys this convention and hides the file. You can turn this off with defaults, but you have to restart the Finder. Option-click on the Finder dock icon to get a Relaunch item.
defaults write com.apple.finder AppleShowAllFiles ON
Wrapping it in a do shell script or pasting it into Terminal is left as ... you know.
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden