"move" in OS X
"move" in OS X
- Subject: "move" in OS X
- From: Hellum Timothy <email@hidden>
- Date: Mon, 14 Apr 2003 11:24:24 -0400
Hello,
We are trying to migrate an OS 9 script to X and are having trouble with
the "move" command. I hope that this question hasn't been asked too much on
this particular issue, but I wonder if anyone might be able to poke a few
holes in the following scripts to demo why it isn't working in X. Thanks
muchly in advance for any ideas/support. Additionally, does anyone know how
to get AS to check a JPEG or EPS for file resolution?
Timothy
tell application "Finder"
activate
select startup disk
set macname to name of startup disk
end tell
global graphics_input_folder, photos_input_folder, log_file, minute_counter,
error_folder
global output_folder1, output_folder2, output_folder3
global ads_input_folder, FillerAds_input_folder, ScannedAds_input_folder
global prod_output_folder1, prod_output_folder2, prod_output_folder3
global log_file, out_log_file, old_log_file
--Editorial Input Folders
set graphics_input_folder to "Layout:Graphics In:"
set photos_input_folder to "Layout:Photos In:"
set error_folder to "Layout:Error:"
--Production Input Folders
set ads_input_folder to "Ads_in:"
set FillerAds_input_folder to "FillerAds_in:"
set ScannedAds_input_folder to "ScannedAds_in:"
--Editorial Output Folders
set output_folder1 to "HighResPhotos:"
set output_folder2 to "LoResPhotos:"
set output_folder3 to "Graphics:"
--Production Output Folders
set prod_output_folder1 to "Ads:"
set prod_output_folder2 to "FillerAds:"
set prod_output_folder3 to "ScannedAds:"
set log_file to macname & ":Move Files:Move_Files_Log.txt"
set old_log_file to macname & ":Move Files:Move_Files_Log.old"
set minute_counter to 1440
on idle
activate
set graphics_list to list folder graphics_input_folder without invisibles
set photos_list to list folder photos_input_folder without invisibles
set ads_list to list folder ads_input_folder without invisibles
set FillerAds_list to list folder FillerAds_input_folder without invisibles
set ScannedAds_list to list folder ScannedAds_input_folder without
invisibles
set minute_counter to minute_counter + 1
set minute_counter to move_files(graphics_list, photos_list, ads_list,
FillerAds_list, ScannedAds_list, minute_counter)
return 60 -- check every 1 minute
end idle
on move_files(graphics_list, photos_list, ads_list, FillerAds_list,
ScannedAds_list, minute_counter)
--keep track of the minutes
--every 24 hours open a new log file
if minute_counter 3 1440 then
try
close access out_log_file
--renameFile "Graphics Flow Tools:Move
Files:Move_Files_Log.txt" to "Graphics Flow Tools:Move
Files:Move_Files_Log.old"
renameFile log_file to old_log_file
on error errMsg number errNum
end try
set out_log_file to open for access file log_file with write
permission
set minute_counter to 0
end if
repeat with an_item in graphics_list
set file_to_move to graphics_input_folder & an_item as string
copyFile file_to_move to output_folder3 with replacing
write (time string of (current date)) & tab & file_to_move & "
copied to graphics folder" & return to out_log_file
deleteFile file_to_move
end repeat
repeat with an_item in photos_list
set file_to_move to photos_input_folder & an_item as string
tell application "Finder"
select file file_to_move
-- info for selection
if file type of (info for selection) is "JPEG" then
copyFile file_to_move to output_folder2 with
replacing
write (time string of (current date)) & tab &
file_to_move & " copied to LoResPhotos folder" & return to out_log_file
end if
if file type of (info for selection) is "EPSF" then
--Open the EPSF file
set input_file to (open for access file
((file_to_move) as string))
try
--read the 1st 500 characters of the EPSF
file
set theData to (read input_file from 1 to
500)
close access input_file --close the file
on error errMsg number errNum
end try
set theheaderlist to +event DTtlAlTi; theData given
+class UsDl;:return
set line8 to item 8 of theheaderlist
if line8 contains "Cyan Magenta Yellow Black" or
line8 contains "Black" then
try
copyFile file_to_move to
output_folder1 with replacing
on error errMsg number errNum
end try
write (time string of (current date)) & tab
& file_to_move & " copied to HighResPhotos folder" & return to out_log_file
else
copyFile file_to_move to error_folder with
replacing
write return & "**** ERROR ****" &
return to out_log_file
write (time string of (current date)) & tab
& file_to_move & " copied to ERROR folder" & return to log_file
write " This file is not CMYK colour" &
return to out_log_file
write "***************" & return & return to
out_log_file
end if
end if
deleteFile file_to_move
end tell
end repeat
--COPY ADS
repeat with an_item in ads_list
set file_to_move to ads_input_folder & an_item as string
--An ad number beginning with 9 is a classified ad
--DO NOT copy the file, just delete it
if file_to_move does not contain ":9" then
copyFile file_to_move to prod_output_folder1 with replacing
write (time string of (current date)) & tab & file_to_move &
" copied to Ads folder" & return to out_log_file
end if
deleteFile file_to_move
end repeat
--COPY Filler Ads
repeat with an_item in FillerAds_list
set file_to_move to FillerAds_input_folder & an_item as string
copyFile file_to_move to prod_output_folder2 with replacing
write (time string of (current date)) & tab & file_to_move & "
copied to FillerAds folder" & return to out_log_file
deleteFile file_to_move
end repeat
--COPY Scanned Ads
repeat with an_item in ScannedAds_list
set file_to_move to ScannedAds_input_folder & an_item as string
copyFile file_to_move to prod_output_folder3 with replacing
write (time string of (current date)) & tab & file_to_move & "
copied to ScannedAds folder" & return to out_log_file
deleteFile file_to_move
end repeat
return minute_counter
end move_files
---------------------------------------------------------------
The Globe and Mail
Canada's National Newspaper
Editorial IT Support
(416) 585-5168
www.globeandmail.ca
_______________________________________________
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.