I need to find a file using Applescript. Applescript is so slow. Someone on the Apple forums gave me some unix code and it works for the most part. The ls command is really list and not find but when it works, it returns the path to the file instantly, NOT 45 seconds Applescript takes.
here is the path to the folder:
/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA/
here is the name of the file:
AFRICA1 Faso, Burkina.doc
here is the shell script I am using that does not work:
text_returned is the result of a dialog box, in this example its AFRICA1
set the_AVSheet to (do shell script "ls '/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA/" & text_returned & "' '*")
can anyone help me get this to work with either ls or a find command. Thank you very much.
I am an audio post engineer who searches a dozen servers for the file I need and write code to help me find the file instead of me clicking 50 times through a folder structure that is brutal. Thanks for any help.
this is how we work. This is the file name:
AFRICA1 Faso, Burkina.doc
We just refer to the project or file as AFRICA1. The rest of the file name sometimes it too hard to remember or pronounce. So in Applescript I use a dialog box to have the user enter the project code (AFRICA1) and I use that info in searching for the file in the folder. I hope that all makes sense. Maybe if I replace "*Burkina" with the variable text_returned that will work.
I'll fix that but do I need to put do shell script in front of the find command and do I need to put quotes before find and after the last character of the command line. thanks
Unfortunately I have a mac at home... but since I work on true unix boxes even at home I use ksh and standard scripts with my mac... You will have to wait I leave work to see what you mean by trying to test on my macbook...
when the user runs the script, a dialog box opens so you can input the 1st part of the filename. i.e. AFRICA123. Its a variable. The path to the folder is pre-determined, you just have to find the AFRICA123 file.
the code below shows the folder path and then the 1st word of the filename for which you are searching.
set the_AVSheet to do shell script "find '/volumes/macintosh HD/Users/shawn/Desktop/Worldreach/AFRICA/' -type f -name & text_returned & " *"