Today I'm having a mac day, played around with xCode, remembered why I love Ruby and Java and don't like to journey down into lower levels. Then I found AppleScript, which is really nice! So I'm trying to make a script that will package my Java applications for school. I seem to be having a problem when telling pages to open the document.

PHP:
set lastName to "SET ME"
set studentID to "SET ME TOO"
set projectName to text returned of (display dialog "Project Name" default answer "UniProject")
set projectNumber to text returned of (display dialog "Project Number" default answer 1)
-- setup the tmp directory
do shell script "rm -fr /tmp/uni-packager"
do shell script "mkdir /tmp/uni-packager"
-- copy the Netbean files
do shell script "cp -r ~/NetBeansProjects/" & projectName & "/ /tmp/uni-packager/project"
-- look for pages doc and compile
set fileLocation to "~/Documents/" & projectName & ".pages"
set pdfLocation to "~/Desktop" & projectName & ".pdf"
tell application "Pages"
open file fileLocation
set product to front document
save product in pdfLocation
end tell
do shell script "mv " & pdfLocation & " /tmp/uni-packager/"
-- do shell script "cp ~/Documents"
-- remove git and mac files
do shell script "rm -r /tmp/uni-packager/project/.git*"
do shell script "find /tmp/uni-packager/. -name *.DS_Store -type f -exec rm {} \\;"
-- compress
do shell script "zip -r ~/Desktop/" & lastName & "_" & studentID & "_project" & projectNumber & ".zip /tmp/uni-packager/*"
-- delete temp
do shell script "rm -rf /tmp/uni-packager"