Hey Guys,
Problem Here…
I’m trying to do a auto search for .indd docs… in a specific folder…
Here’s what I have:
tell application "Finder"
activate
repeat
display dialog "Entrer le code de la semaine" default answer "" buttons {"Cancel", "OK"} default button 2
set the datacode to the text returned of the result
if the datacode is not "" then exit repeat
end repeat
open folder "PKG" of folder "REDACTION" of folder "DOCUMENTS" of folder ("JLAF" & datacode) of folder "2015" of folder "JOURNAL LES AFFAIRES" of folder "Archive" of disk "Magazines"
tell front Finder window
set toolbar visible to true
set the current view to list view
end tell
end tell
tell application "System Events"
tell process "Finder"
set value of text field 1 of group 5 of toolbar 1 of window "PKG" to ".indd" then
--delay 0.5 -- wait for Sys Events to get to the right place before clicking.
--click radio button 2 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
end tell
end tell
For the Click radio… I nock out because it keep given me error of “System Events got an error: Can’t get group 1 of splitter group 1 of window 1 of process “Finder”. Invalid index.” and the toolbar for searching the content does not appear in the window
Everything going well, but at the end the word “.indd” gets entered in the search box but everything stop…
it does not proceed the action. it’s like if it was missing the press down on ENTER for it to continue…
And the search bar detail box does appear…
P.S. How do you insert an ing inn the post ?
if you are trying to find everything that ends with .indd in a specific folder, i would just use a shell script
(*
Syntax: find X -name Y
X is the location of the folder
Y is the name of what you're trying to find (if you want to find anything with a specific extention do *.(what you want it to end with)
* is a wildcard (can be anything)
example *)
do shell script "find /Documents/ThisFolder -name *.indd"
Hi,
actually it’s not necessary to search in a window
repeat
display dialog "Entrer le code de la semaine" default answer "" buttons {"Cancel", "OK"} default button 2
set the datacode to the text returned of the result
if the datacode is not "" then exit repeat
end repeat
set theFolder to "Magazines:Archive:JOURNAL LES AFFAIRES:2015:JLAF" & datacode & ":DOCUMENTS:REDACTION:PKG:"
tell application "Finder"
set inddFiles to every file in folder theFolder whose name extension is "indd"
end tell
or, if you want to open the Finder window anyway and select the found files in the window
repeat
display dialog "Entrer le code de la semaine" default answer "" buttons {"Cancel", "OK"} default button 2
set the datacode to the text returned of the result
if the datacode is not "" then exit repeat
end repeat
set theFolder to "Magazines:Archive:JOURNAL LES AFFAIRES:2015:JLAF" & datacode & ":DOCUMENTS:REDACTION:PKG:"
tell application "Finder"
open folder theFolder
tell front Finder window
set the current view to list view
end tell
select (every file in folder theFolder whose name extension is "indd")
end tell
Hello Stefan
You have a good idea but it dosent search the subfolders ?
It only does a selection… if there is any in the source folder…
Any other suggestion PLEASE…
P.S. The shell script doesn’t work 
You didn’t mention that you want to search the subfolders, too.
What are you going to do with the found files?