How do I adjust this script to allow me to choose files not in a 'pages only' folder, and instead multiple "free" files?
Keyword here is 'single'. I'm by no means a coding expert but I've learned about automator recently and it's been incredibly useful when converting PNG images to .ICNS
I was sending a classmate a folder with my notes for a course and I realized he's got a PC and I have a Mac, so I should convert the pages documents to .docx so he can open them. I have many other instances where this is necessary. I did some looking online and I created a quick action, and it works! I've tested it a few times and its almost exactly what I need.
The only problem is it only works if all the documents are in a separate folder of only pages documents and I want a way to get around that. If I could select multiple pages documents at a time without putting them in a separate folder first that would be great!
This is the script I'm using:
--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
I think I have to change "theSourceFolder" to maybe "theSourceFile"? but I also am pretty sure there's more to the script than I understand and I have a feeling that if I try tinkering with it I'll ruin it.
also maybe if I could just select the file in finder without the pop-up window prompting me to select a file that would be even better!
Thanks for your help in advance!