Hello,
as you can probably tell from the script below I am new to Applescript (I used to ‘Record’ and edit scripts under OS7 to OS8 though). My main problem is when I try to move files simply from one folder to another (using OS 10.2.8 ), everything else seems to be working fine.
Secondly, I wonder if there is a way to lessen the amount of script by putting the repeated commands in a ‘function’ that can be used again and again.
Hope there is someone out there willing to help. Thank you for your time.
Well, here’s my script so far – cumbersome I know! Problem lines are in RED
on adding folder items to this_folder after receiving fileList
set theNewName to (do shell script "date +%Y-%m-%d_%H-%M")
set toDesk to path to desktop as text
set doneFolder to toDesk & "mm_done:" as text
set processFolder to toDesk & "mm_process:" as text
repeat with i in fileList
tell application "Finder" to set thisFileType to the file type of i
say thisFileType
if thisFileType is "JPEG" then
do shell script "chmod 766 " & quoted form of POSIX path of i
set theNewName to theNewName & ".jpg"
tell application "Finder" to set name of i to theNewName
[b][color=red]move the file theNewName to doneFolder[/color][/b]
else if thisFileType is "TEXT" then
do shell script "chmod 766 " & quoted form of POSIX path of i
set theNewName to theNewName & ".txt"
tell application "Finder" to set name of i to theNewName
[b][color=red]move the file theNewName to doneFolder[/color][/b]
else
-- I'll think about this bit later!
say "oops!"
end if
end repeat
say "done"
end adding folder items to