Skip to content

Commit bb43ef5

Browse files
committed
Initial commit.
0 parents  commit bb43ef5

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

PoorSelect.applescript

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
on run --for dialog
2+
if existsWindow() then
3+
display dialog "Filter word" default answer "" buttons {"OK"} default button 1
4+
set userInput to text returned of result
5+
main(userInput)
6+
end if
7+
end run
8+
9+
on alfred_script(userInput) --for Alfred
10+
if existsWindow() then
11+
main(userInput)
12+
end if
13+
end alfred_script
14+
15+
on handle_string(userInput) --for LaunchBar
16+
if existsWindow() then
17+
main(userInput)
18+
end if
19+
end handle_string
20+
21+
on existsWindow()
22+
tell application "Finder"
23+
if Finder window 1 exists then
24+
true
25+
else
26+
false
27+
end if
28+
end tell
29+
end existsWindow
30+
31+
on main(userInput)
32+
tell application "Finder"
33+
set targetFolder to target of Finder window 1
34+
set posixPath to (targetFolder as alias)'s POSIX path
35+
end tell
36+
37+
set shellText to "ls " & quoted form of posixPath & " | iconv -f UTF-8-MAC -t UTF-8 | grep " & userInput
38+
39+
try
40+
set tempList to do shell script shellText
41+
42+
script listWrapper
43+
property contents : paragraphs of tempList
44+
end script
45+
46+
set fileList to {}
47+
48+
repeat with an_item in contents of listWrapper
49+
set filePath to posixPath & an_item
50+
set end of fileList to POSIX file filePath as alias
51+
end repeat
52+
53+
tell application "Finder"
54+
reveal fileList
55+
activate
56+
end tell
57+
58+
try
59+
display notification ((number of fileList) as text) & " items are matched"
60+
end try
61+
on error msg
62+
log msg
63+
try
64+
display notification "N/A"
65+
on error
66+
display alert "N/A"
67+
end try
68+
69+
end try
70+
end main

readme.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#PoorSelect
2+
3+
##About
4+
5+
PoorSelect find items which match with specified condition at selected location in Finder , and select them.(This is inspired by PowerSelect)
6+
7+
##Usage
8+
9+
- Add Finder Toolbar
10+
- Use from LaunchBar or Alfred.
11+
12+
##Download
13+
14+
Click Here → [Download](https://github.com/veadar/PoorSelect/releases)
15+
16+
17+
##Special Thanks & Used Codes
18+
19+
- <a href="http://www.script-factory.net/software/FinderHelpers/PowerSelect/">PowerSelect</a>
20+
- <a href="http://memogakisouko.appspot.com/MenuBarAppleScript.html">MenuBarAppleScript</a>
21+
- [IconEden
22+
](https://www.iconfinder.com/icons/61494/30_filter_icon)

0 commit comments

Comments
 (0)