Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create a command to 'cd' to frontmost Finder window' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a command to 'cd' to frontmost Finder window
Authored by: jacobolus on Oct 04, '05 11:34:52AM
because this script only does one line, we can just do:
cdh() # cd's to frontmost window of Finder
{
cd "`osascript -e 'tell application "Finder" to set myname to \
POSIX path of (target of window 1 as alias)' 2>/dev/null`"
}
or something similar

[ Reply to This | # ]
Create a command to 'cd' to frontmost Finder window
Authored by: jacobolus on Oct 04, '05 11:38:48AM

My code there got its backslash taken out. But add it in to make the script work.



[ Reply to This | # ]
Create a command to 'cd' to frontmost Finder window
Authored by: jacobolus on Oct 04, '05 11:52:05AM
If we want to make sure to get the "quoted form", I guess we can do this:
cdh() # cd's to frontmost window of Finder
{
eval cd "`osascript -e 'tell application "Finder" to set return to quoted \
form of POSIX path of (target of window 1 as alias)' 2>/dev/null`"
}


[ Reply to This | # ]