simplify this script
simplify this script
- Subject: simplify this script
- From: "Jan-Bultereys" <email@hidden>
- Date: Tue, 14 Dec 2004 15:27:46 +0100
- Thread-topic: simplify this script
Hi,
Can someone help me to simplify this script.....
Look at block 2 .... it's just the same as block 1 but it is pointing to a folder called "2" instead of "1"
I will have to do this 500 times and I guess this is not the best solution to copy and pasted
the blocks over and over....?
just a little explanation wath this script does....
- look at files in "final_result"...
- if the name starts with "PAG1_" move to folder 1 and then delete "PAG1_" of that file name....
- if the name starts with "PAG2_" move to folder 2 and then delete "PAG2_" of that file name....
......this has to be done to 500 folders......
any input is very much appreciated,
----begin --- BLOCK PAGE 1 -----
tell application "Finder"
activate
set FINAL_RESULT to folder "to_path_name:FINAL_RESULT:" as alias
set FINAL_RESULT1 to folder "to_path_name:FINAL_RESULT_PAGES:1" as alias
set file_list_family to (every item of FINAL_RESULT)
repeat with temp_file in file_list_family
set temp_name to name of temp_file
if temp_name starts with "PAG1_" then
try
move temp_file to folder FINAL_RESULT1 with replacing
end try
end if
end repeat
end tell
---declareren van delimiter---
set text item delimiters to "PAG1_"
tell application "Finder"
set FINALRESULT1 to folder "to_path_name:FINAL_RESULT_PAGES:1" as alias
repeat with i in (get files of folder FINALRESULT1)
set i's name to text item -1 of (get i's name)
end repeat
end tell
----END --- BLOCK PAGE 1 -----
----begin --- BLOCK PAGE 2 -----
tell application "Finder"
activate
set FINAL_RESULT to folder "to_path_name:FINAL_RESULT:" as alias
set FINAL_RESULT2 to folder "to_path_name:FINAL_RESULT_PAGES:2" as alias
set file_list_family to (every item of FINAL_RESULT)
repeat with temp_file in file_list_family
set temp_name to name of temp_file
if temp_name starts with "PAG2_" then
try
move temp_file to folder FINAL_RESULT2 with replacing
end try
end if
end repeat
end tell
---declareren van delimiter---
set text item delimiters to "PAG2_"
tell application "Finder"
set FINALRESULT2 to folder "to_path_name:FINAL_RESULT_PAGES:2" as alias
repeat with i in (get files of folder FINALRESULT2)
set i's name to text item -1 of (get i's name)
end repeat
end tell
----END --- BLOCK PAGE 2 -----
set text item delimiters to ""
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden