Last active
November 11, 2024 20:35
-
-
Save ldavidh/3f378bbf00621d23b07f3de42a0012a4 to your computer and use it in GitHub Desktop.
alternate sel script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cd into directory in Finder's front window | |
function cdf() { | |
finderPath=`osascript -e 'try | |
tell application "Finder" to set the source_folder to (folder of the front window) as alias | |
on error | |
tell application "Finder" to set source_folder to insertion location as alias | |
end try | |
return POSIX path of source_folder as string'` | |
cd "$finderPath" | |
} | |
#run ls for directory in Finder's front window | |
function lsf() { | |
finderPath=`osascript -e 'try | |
tell application "Finder" to set the source_folder to (folder of the front window) as alias | |
on error | |
tell application "Finder" to set source_folder to insertion location as alias | |
end try | |
return POSIX path of source_folder as string'` | |
# echo "$finderPath" | |
# echo "-------------------------------------------------------" | |
ls "$finderPath" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sel() { | |
workingD=$PWD | |
applescript='set theFiles to {}' | |
while read LINE; do | |
aLine=${LINE} | |
if [ ! -z "$aLine" -a "$aLine" != "" ]; then | |
filez="${workingD}/${aLine}" | |
applescript+=" | |
try | |
set aFile to POSIX file \"$filez\" | |
set testFile to aFile as alias | |
if testFile is not missing value then | |
set end of theFiles to aFile | |
end if | |
(* on error errMsg | |
display dialog errMsg | |
*) | |
end try" | |
fi | |
done | |
applescript+=' | |
if (count of theFiles) > 0 then | |
tell application "Finder" | |
select theFiles | |
activate | |
end tell | |
end if | |
return' | |
echo "$applescript" | osascript - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment