Cómo puedo ajustar este script para que me permita elegir los archivos no en una carpeta de "sólo páginas", y en su lugar múltiples archivos "libres"?
La palabra clave aquí es "único". No soy de ninguna manera un experto en codificación, pero he aprendido sobre automator recientemente y ha sido increíblemente útil al convertir imágenes PNG a .ICNS
Estaba enviando a un compañero de clase una carpeta con mis apuntes para un curso y me di cuenta de que él tiene un PC y yo un Mac, así que debería convertir los documentos de las páginas a .docx para que él pueda abrirlos. Tengo muchos otros casos en los que esto es necesario. Busqué un poco en Internet y creé una acción rápida, ¡y funciona! Lo he probado varias veces y es casi exactamente lo que necesito.
El único problema es que sólo funciona si todos los documentos están en una carpeta separada de sólo páginas de documentos y quiero una forma de evitarlo. Si pudiera seleccionar varios documentos de páginas a la vez sin ponerlos en una carpeta separada primero, sería genial.
Este es el script que estoy utilizando:
--Select from where you will pick up the pages files
set theSourceFolder to choose folder with prompt "Select folder with original pages files :"
--Do it
tell application "Finder"
set theNames to name of files of theSourceFolder ¬
whose name extension is "pages"
end tell
--Select where the files will go
set theDestinationFolder to choose folder with prompt "Select folder where files will go :"
-- How many files to export
set item_count to (get count of items in theNames)
--Get files and export them
repeat with i from 1 to item_count
set current_file to item i of theNames -- get a file
set lean_file to text 1 thru -7 of current_file & ".docx" -- change the originalfile (.pages) to a .MS Word name
set out_file to (theDestinationFolder as Unicode text) & (lean_file) -- get the fully qualified output name
set in_file to (theSourceFolder as Unicode text) & (current_file) -- get the fully qualified input file name
tell application "Pages"
set mydoc to open file in_file -- open input file in Pages
export mydoc to file out_file as Microsoft Word --do the exporting
close mydoc saving no -- close the original file without saving
end tell
end repeat
return input
end run
Creo que tengo que cambiar "theSourceFolder" por quizás "theSourceFile" pero también estoy bastante seguro de que hay más cosas en el script de las que entiendo y tengo la sensación de que si intento retocarlo lo arruinaré.
editar:
Además, si pudiera seleccionar el archivo en el Finder sin que la ventana emergente me pidiera que seleccionara un archivo, sería aún mejor.
Gracias por su ayuda de antemano.