aha! thanks for the reply. i do not know what i was doing wrong, but putting into script editor and just saving immediately seems to work now.
i am also trying to adapt this to export word files, but I'm getting an error in this screenshot.
i realise this is not really related to the original thread... but my limited knowledge of applescript is not really paying off.

here is the code I've been playing with:
--Select from where you will pick up the pages files
set theFolder to choose folder with prompt "Select folder with original pages files :"
--Do it
tell application "Finder"
set theNames to name of files of theFolder ¬
whose name extension is "pages"
end tell
--Select where the Word files will go
set docx_Folder to choose folder with prompt "Select folder where Word 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 .docx name
set out_file to (docx_Folder as Unicode text) & (lean_file) -- get the fully qualified output name
set in_file to (theFolder 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 docx --do the exporting
close mydoc saving no -- close the original file without saving
end tell
end repeat
display dialog "done" -- Job done