Fwd: Network volume considerations when working with files?
Fwd: Network volume considerations when working with files?
- Subject: Fwd: Network volume considerations when working with files?
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 1 Aug 2007 09:46:53 -0400
Brett sent this only to me instead of to the list... I can't look at it right now but maybe Ed or someone else can.
Brett: the text of the error messages would also be helpful.
---------- Forwarded message ----------
From: Brett Conlon <email@hidden
>
Date: Aug 1, 2007 1:01 AM
Subject: Re: Network volume considerations when working with files?
Here's the script... thanks to the recent
thread about spotlight searching I was able to write the below script.
It scanned 67GB of PDF files to find 1500 jobs containing specific catalogue
numbers inside them - all in one swift go! I estimated that it saved us
almost 42 hours worth of locating, moving and naming the files manually
- Go AppleScript!!!!
I've deleted the Pashua dialog handle
but here's the script - plz go easy on me... I still feel like I should
be in AppleScript nappies (Oz for diapers).
on
run
set
ThisSearch
to
""
DoThis(ThisSearch
)
end
run
on
open
ThisSearch
if
class
of
ThisSearch
is not
folder
then
display
dialog "Only drop FOLDERS you
wish to search onto this script." buttons
{"Sorry"} default
button 1 with
icon stop
else
DoThis(ThisSearch)
end
if
end
open
on
DoThis(ThisSearch)
set
pashuaResult
to
my
pashua_run(ThisSearch)
set
ThisSearch
to
ThisSearch
of
pashuaResult
set
TheDestination
to
TheDestination
of
pashuaResult
set
TheDestination
to
POSIX file
TheDestination
--set
SearchElements to SearchElements of pashuaResult (*this is commented out
coz I couldn't get Pashua to return more than the first value from a whole
column of values copied & pasted from an Excel spreadsheet, so I had
to resort to the below AppleScript dialog*)
set
SearchElements
to
paragraphs
of
text returned
of
(display dialog
¬
"Enter text to search. Note: separated
multiple items by a return:" default
answer return)
set
CopyMove
to
CopyMove
of
pashuaResult
set
POSIXSearch
to
quoted form
of
POSIX path
of
ThisSearch
tell
me
to
activate
repeat
with
anElement
in
SearchElements
try
set
FoundFile
to
(do shell script
"mdfind -onlyin " & POSIXSearch
& " \"kMDItemTextContent == '" & anElement
& "'\"") as
Unicode text
set
AppleScript's
text item delimiters
to
return
--this helps
split up multiple found items
set
myItems
to
text items
of
FoundFile
set
AppleScript's
text item delimiters
to
""
repeat
with
i
in
myItems
set
i
to
POSIX file
i
tell
application
"Finder"
set
iName
to
name
of
i
if
CopyMove
is
"Move" then
set
IMoved
to
move
i
to
TheDestination
else
set
IMoved
to
duplicate
i
to
TheDestination
end
if
set
the
name
of
IMoved
to
anElement
& " " & iName
end
tell
end
repeat
on
error
""
end
try
end
repeat
tell
application
"Finder"
open
TheDestination
activate
beep
2
display
dialog "The search is complete."
end
tell
end
DoThis
--
Mark J. Reed <
email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden