You can try something like this:
on open droppedItem
-- Assume dropped files are are in the same folder
-- Call SaveFilesAsSVG to create svg versions of each dropped file next to the originals in the same folder
set droppedItem to first item of droppedItem
tell application "System Events" to kind of droppedItem = "Folder"
if the result then
tell application "System Events" to set myFileList to files of droppedItem whose visible is true
SaveFilesAsSVG(myFileList, droppedItem's POSIX path, droppedItem)
end if
end open
on run
-- Ask for a destination folder with a defined relative path as the default
set mydestFolder to (choose folder with prompt "Select destination folder")
-- Ask for a source folder with a defined relative path as a default
set myFilePath to (choose folder with prompt "Select source folder")
-- Create fileList
tell application "System Events" to set myFileList to files of myFilePath whose visible is true
-- Call SaveFilesAsSVG to create an svg version of each file with a defined extension found in the source folder in the destination folder
SaveFilesAsSVG(myFileList, myFilePath's POSIX path, mydestFolder)
end run
on SaveFilesAsSVG(fileList, filePath, destFolder)
set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
tell application "System Events" to set fileName to (item i of fileList)'s name
set fileNameBase to getBaseName(item i of fileList)
set fullPath to filePath & fileName
set newFilePath to destPath & fileNameBase & ".svg"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as SVG ¬
with options {class:SVG export options ¬
, embed raster images:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsSVG
on getBaseName(myFile)
tell application "System Events" to set {fileName, fileExt} to {name, name extension} of myFile
return text 1 thru ((get offset of "." & fileExt in fileName) - 1) of fileName
end getBaseName