Re:is this possible?
Re:is this possible?
- Subject: Re:is this possible?
- From: Kok Ooi Kong <email@hidden>
- Date: Fri, 1 Aug 2003 04:14:39 +0800
Hi,
I think the following should help. At least you can think along the
line.
It can be further simplified into using handlers for a few parts. I
will leave it to you. In fact other may suggest a much shorter script -
I am just following your line of thought because I'm not sure what
exactly you are trying to do with the files. This script has a problem
that it may take a long while to run - especially when there are many
files, files are very long with many paragraphs and words... The number
of loops is incredible.
--start of script--
on open (myFolder)
set pathLs to {"Library:Preferences:", "Library:Preferences:ByHost:"}
set FoldLs to {{"fileA.plist", "fileB", "fileC"}, {"fileX", "fileY",
"fileZ"}}
tell application "Finder"
set CYFold to (every folder in myFolder)
repeat with cy in CYFold
set UsrFold to (every folder in cy)
repeat with un in UsrFold
repeat with t from 1 to (count of items in pathLs)
set pathA to ((un as string) & item t of pathLs) as alias
set filepathA to (every file in pathA)
repeat with fileA in filepathA
if (the name of fileA) is in item t of FoldLs then
set theContent to read file (fileA as string)
set theContent1 to every paragraph of theContent
repeat with p from 1 to (the count of items in theContent1)
if (item p of theContent1) contains "/Library/filename.plist"
then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ASCII character 32
-- space
set para to (item p of theContent1)
set ItemWd to every text item of the para
repeat with i from 1 to (count of items in ItemWd)
if item i of ItemWd is "/Library/filename.plist" then
copy
"/Network/Servers/ServerName/Volumes/VolumeName/Students/ClassYear/
Username/Library/Preferences/FolderName/filename.plist" to item i of
ItemWd
end if
end repeat
set para to ItemWd as text
set AppleScript's text item delimiters to return
copy para to item p of theContent1
end if
end repeat
set theContent to theContent1 as text
set AppleScript's text item delimiters to tid
set theFile to open for access file (fileA as string) with write
permission
write theContent to theFile
close access file (fileA as string)
end if
end repeat
end repeat
end repeat
end repeat
end tell
end open
--end of script--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.