Hi, Id like to make a dropplet that can archive by partial file name. I cant really find a starting point so far. I have a script i use from this site called FileShuttleX which archives by filetype but its non editable
So we have a very standard file naming system. for example
Mail_1907_FP_Nationwide bubb (col)
Tele_1907_25x4_Nationwide simp
So the start is the publication. next date as DDMM. advert size. Client name. and Ad type. and color or not
Would it be possible to do this so it archives by the 3 peramiters, client name, color or not and ad type.
The files would be going onto a server under - eg. xserve:Nationwide:color ads:bubbles ads or xserve:nationwide:mono ads:simplicity
I dont mind having to assign all the folders on the xserve manually.
Any starting point would be very helpfull. Thx in advance
Hi,
something like this, it considers only the options you’ve described (mono/color, bubble/simplicity),
the client name (Nationwide) can be anything. There is no further error handling, the subfolders must exist
property servername : "xserve:"
on open theseFiles
repeat with oneFile in theseFiles
set {name:Nm, name extension:Ex} to info for oneFile
if Ex is missing value then set Ex to ""
if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set {TID, text item delimiters} to {text item delimiters, "_"}
set typeName to text item 4 of Nm
set text item delimiters to space
tell typeName to set {clientName, _type} to {text item 1, text items 2 thru -1 as text}
set text item delimiters to TID
if _type ends with "(col)" then
set colorFolder to "color ads:"
set _type to text 1 thru -7 of _type
else
set colorFolder to "mono ads:"
end if
set typeFolder to item (((_type is "bubb") as integer) + 1) of {"simplicity:", "bubbles ads:"}
set archiveFolder to servername & clientName & ":" & colorFolder & typeFolder
tell application "Finder" to move oneFile to folder archiveFolder
end repeat
end open
Or alternatively construct an array of addresses for the names in another array:
-- want to distinguish: Client Name, Ad Type, Color (boolean)
set FN to {"Mail_1907_FP_Nationwide bubb (col)", "Tele_1907_25x4_Nationwide simp"}
set Srvr to "somePath" -- to the container of these
set Addr to {} --> becomes {"somePath/Nationwide/inColor/bubb", "somePath/Nationwide/B&W/simp"}
set tid to AppleScript's text item delimiters
repeat with I in FN
set col to "B&W"
set AppleScript's text item delimiters to "_"
set tParts to text items of I
set tClient to word 1 of item 4 of tParts
set tType to word 2 of item 4 of tParts
if item 4 of tParts contains "(col)" then set col to "inColor"
set end of Addr to Srvr & "/" & tClient & "/" & col & "/" & tType
end repeat
set AppleScript's text item delimiters to tid
Thanks very much il see what i can workout from this!