I made this scrip a long time ago and use(d) it often to get rid of dektop clutter. Unfotunately, since I upgraded to OS 10.3.9 I get errors and I can’t figure out the new syntax to use to correct the problems. When I correct one problem another arrises at another point in the script. If someone can help me update this script to work with OS 10.3.9 I would truly appreciatethe help. Thanks in advance.
-G
property thisList : {}
property date_n_time : ""
dateTimeGetter()
tell application "Finder"
set dt to (desktop) as string
set the_files to every file of folder dt
try
make new folder at startup disk with properties {name:"Cleanup"}
end try
try
make new folder at desktop with properties {name:date_n_time}
end try
end tell
set desktopPath to path to desktop
set these_items to list folder desktopPath
tell application "Finder"
repeat with i from 1 to the count of these_items
set this_item_name to item i of these_items
set this_item to (desktopPath as string) ¬
& this_item_name as alias
if (class of this_item is not disk) ¬
and (the first character of this_item_name ¬
is not ".") then
set name_extension to (name extension of (info for this_item))
tell application "Finder"
if name_extension is in {"mov", "mpg", "avi", "wmv", "MPG", "mpeg", "moov"} then
try
make new folder at folder date_n_time with properties {name:"Movies"}
end try
move this_item to folder "Movies" of folder date_n_time of desktop
else if name_extension is in {"jpg", "jpeg", "png", "gif", "bmp", "pdf", "tif", "art", "pic", "pict", "pictureClipping"} then
try
make new folder at folder date_n_time with properties {name:"Pictures"}
end try
move this_item to folder "Pictures" of folder date_n_time of desktop
else if name_extension is in {"mp3", "wav", "mp4", "mid", "aif", "aiff"} then
try
make new folder at folder date_n_time with properties {name:"MusicAndSound"}
end try
move this_item to folder "MusicAndSound" of folder date_n_time of desktop
else if name_extension is in {"textClipping", "text", "html", "htm", "js"} then
try
make new folder at folder date_n_time with properties {name:"Text"}
end try
move this_item to folder "Text" of folder date_n_time of desktop
else
set theKind to (kind of (info for this_item))
if theKind is not "folder" then
move this_item to folder date_n_time of desktop
end if
end if
end tell
end if
end repeat
tell application "Finder"
if the_files ≠{} then
try
move folder date_n_time to folder "Cleanup" of startup disk
end try
else
move folder date_n_time to trash
end if
end tell
end tell
to dateTimeGetter()
tell application "Finder"
set cd to (current date) as string
set theDay to item 1 in cd & item 2 in cd & item 3 in cd as string
(*set d1 to item 1 in cd
set d2 to item 2 in cd
set d3 to item 3 in cd*)
set m to (month of (current date) as integer)
if m < 10 then (*create leading zero for month*)
set m to "0" & m
end if
set d to day of (current date)
if d < 10 then (*create leading zero for day*)
set d to "0" & d
end if
set yod to year of (current date) as string
set y to count of items in yod
set c to count of items in cd
if item (c - 10) in cd is " " then (*create leading zero for hour*)
set c10 to 0
else
set c10 to 1
end if
set c9 to item (c - 9) in cd
if item (c - 10) in cd is equal to "1" and item (c - 9) in cd is equal to "2" then
set c10 to 0
set c9 to 0
end if
set date_n_time to m & "/" & d & item (c - 1) in cd & item c in cd & c10 & c9 & "/" & item (c - 7) in cd & item (c - 6) in cd & "/" & item (c - 4) in cd & item (c - 3) in cd & theDay as string
end tell
log c10
log c9
end dateTimeGetter
Model: iMac
AppleScript: 1.9.3
Browser: Safari 312.6
Operating System: Mac OS X (10.3.9)