I have a script, that exports a document from adobe illustrator, however, spaces in the file name become hyphens, I am trying to change them back to spaces…
it does not work however, any ideas?
tell application “Adobe Illustrator”
activate
set inputPath to (file path of current document) as string
end tell
set text item delimiters to “:”
set oldfile_name to last text item of inputPath as text
set newfile_name to ((text 1 thru -4 of oldfile_name) & “.jpg”) as string
set text item delimiters to “:”
set fileLocation to text items 1 thru -2 of inputPath as string
tell application “Adobe Illustrator”
activate
export current document to file (fileLocation & “:” & newfile_name) as JPEG with options {class:JPEG export options, quality:80, horizontal scaling:700, vertical scaling:700, matte:false}
end tell
set ourText to newfile_name
set findThis to " "
set replaceItWith to “-”
set newText to switchText of ourText from findThis to replaceItWith
to switchText of theText from SearchString to ReplaceString
set OldDelims to AppleScript’s AppleScript’s text item delimiters
set AppleScript’s AppleScript’s text item delimiters to SearchString
set newText to text items of theText
set AppleScript’s AppleScript’s text item delimiters to ReplaceString
set newText to newText as text
set AppleScript’s AppleScript’s text item delimiters to OldDelims
return newText
end switchText
set illFileName to newText as string
tell application “Finder”
activate
set illFilePath to (fileLocation & “:” & illFileName) as alias
set name of file illFilePath to (fileLocation & “:” & newfile_name)
end tell