Distinguish between AW5 and 6 in script
I'm trying to create an application in Automator to automate the conversion of AW to iWork. I'm using one of Yvan's scripts to convert AW6 to iWork successfully. The only step remaining is to convert to AW6 from 5, something that shouldn't be too hard since all it has to do is open and save. However, I can't find a good way to distinguish between AW5 and 6. In his script, I believe Yvan does this here:
on AWtoAW6(leCheminOriginal_UniText) -- leCheminOriginal_UniText est Unicode text
local leFichier, flag, nf, l, nouveauChemin
set leFichier to leCheminOriginal_UniText as alias
try
tell application "AppleWorks 6.2.9"
activate
openleFichier
set nf to name of document 1
if nf contains v6 then
set AppleScript's text item delimiters to v6
set l to text items of nf
set AppleScript's text item delimiters to ""
set nf to l as text
end if
if nf does not end with ".cwk" then set nf to nf & ".cwk"
set nouveauChemin to cheminDeStockage & nf
tell application "System Events"
if exists (file nouveauChemin) then set name of file nouveauChemin to (text 1 thru -(2 + (length of "cwk")) of nf) & my horoDateur(modification date of file nouveauChemin) & ".cwk" (* name stamped *)
makenewfileat end of foldercheminDeStockagewith properties {name:nf, file creator:"BOBO", file type:fileType}
end tell
set leFichier to nouveauChemin as alias
savedocument 1 inleFichier
closedocument 1
end tell -- AppleWorks 6
on error
set rapport to rapport & msg96 & nouveauChemin & return
end try
end AWtoAW6
But I'm not sure. What I need is a script that opens, checks if it's an AW5 file, if it is opens and saves in AW6, and then proceeds to open my other script that can do the