Mientras sigo desarrollando un scriptmás grande (que está funcionando pero para esto), no puedo averiguar cómo insertar un archivo en un documento de Word usando Applescript. Puedo insertar una imagen, pero si el archivo es un documento de Word, una hoja de cálculo de Excel, un archivo de vídeo, etc., no puedo ver en el diccionario dónde están los comandos que lo manejarían. Este ejemplo casi funciona:
on AddAttachmentFileToWordDoc(FilePath, Extension)
set GraphicFiles to {"PDF", "jpg", "giff", "TIFF", "gif", "png", "PPM", "PGM", "PNM"}
set VideoFiles to {"mov", "wmv", "amv", "mp4", "m4p", "mpg", "mpeg", "m4v"}
tell application "Microsoft Word"
activate
tell active document
set ContTemp to content of text object
set StartRange to (count of ContTemp) - 1
set endrange to StartRange
set theRange to create range start StartRange end endrange
tell theRange
if GraphicFiles contains Extension then
--this works well
make new inline picture at end with properties {file name:FilePath as text, save with document:true}
else if VideoFiles contains Extension then
--this obviously doesn't work, but I would guess that something close to it should.
make new video at end with properties {file name:FilePath as text, save with document:true}
else -- everything else, Word docs, excel, etc.
--make new what?? There is no option for new inline file . . .
end if
end tell
end tell
end tell
end AddAttachmentFileToWordDoc
Como puedes ver sólo he tenido éxito con los archivos gráficos. ¿Alguna idea de cuál debe ser la sintaxis para los otros tipos de archivos? Muchas gracias.