Something like this should work, but keep in mind it only uses folders that are firstly resident on the desktop.
I've yanked most of it from a file renamer routine I wrote, so it might need some further modification.
property DarnWindowsIllegalCharacters : {"?", "[", "]", "/", "=", "+", "<", ">", ":", ";", ",", "*", "|", "^", "\\", "\""}
on open {}
set DesktopPath to path to desktop
tell application "Finder"
set theFolderAlias to the selection as alias
set theFolder to the selection as text
set theSelection to (entire contents of folder theFolder)
try
set y to count of (theSelection)
repeat with x from 1 to y
try
set CycleItem to item x of theSelection
if class of CycleItem is folder then
set shortname to (CycleItem's name) as string
repeat with THECHARACTER in DarnWindowsIllegalCharacters
set shortname to my replace_chars(shortname, THECHARACTER, "-")
end repeat
set name of CycleItem to shortname
end if
end try
end repeat
set shortname to name of folder theFolder
repeat with THECHARACTER in DarnWindowsIllegalCharacters
set shortname to my replace_chars(shortname, THECHARACTER, "-")
end repeat
set name of folder theFolder to shortname
on error errMsg number errNum
tell application "Finder"
activate
display dialog errMsg & return & "Error in ZiptheFile 1" & return & errNum as string
end tell
end try
end tell
tell application "Finder"
try
tell application "DropStuff"
activate
zip ((DesktopPath & shortname) as string) -- This part restricts to desktop folders
quit
end tell
on error errMsg number errNum
tell application "Finder"
activate
display dialog errMsg & return & "Error in ZiptheFile 2" & return & errNum as string
end tell
end try
end tell
end open
on replace_chars(this_text, search_string, replacement_string)
set KeepDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to KeepDelimiters
return this_text
end replace_chars