Re: Network volume considerations when working with files?
Re: Network volume considerations when working with files?
- Subject: Re: Network volume considerations when working with files?
- From: Brett Conlon <email@hidden>
- Date: Thu, 2 Aug 2007 11:45:12 +1100
Daing, how'd I miss it... Thanks for
the heads-up Mark... my apologies Ed!
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>
Sent by: email@hidden
01/08/07 12:52 PM
|
To
| "Brett Conlon" <email@hidden>
|
cc
|
|
Subject
| Re: Network volume considerations when
working with files? |
|
? You got a reply, Brett. Ed suggested you use
aliases and asked for code.
On 7/31/07, Brett Conlon <email@hidden> wrote:
> Hiya,
>
> Any thoughts... it's still plaguing me.
>
> Ta muchly,
>
> Coj
>
> ----- Forwarded by Brett Conlon/HU/AU/SonyDADC on 01/08/07 09:30 AM
-----
>
> Brett Conlon/HU/AU/SonyDADC
> 30/07/07 10:48 AM
>
> To
> Apple Script
> cc
>
> Subject
> Network volume considerations when working with files?
>
>
>
>
>
> Hi all,
>
> I have 2 scripts which work fine locally but seem to choke when they
are
> run over a network volume.
>
> What considerations need to be used when sourcing/moving files to/from
> network volumes? Is it simply that the path needs to start with /Volumes/?
> If so, I definitely know one of my scripts having this issue shows
the
> full path starting with /Volumes/BLAH/etc...
>
> Many thanks,
>
> Cojcolds
>
> ps. scripts can be provided if the above isn't enough to go off.
--
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