Unicode Problem with 10.5.8 from 10.4.11

At my company we run an AppleScript that retrieves information from our database program and uses it to place PDF images on the correct layer & page of InDesign documents. We recently upgraded from 10.4.11 to 10.5.8 and have run into some problems.

Now the script is only partially working. The script cannot recognize any page beyond 11. By this I mean all PDF images place correctly on a given layer for pages 1-10. For any page after 11 the script reports that it cannot get that page.

I believe this is because the newer version of AppleScript is completely Unicode text based but the older script is not. How do I get the script to recognize the numbers 11 and above?

Here is an excerpt of the script that I believe is causing the issue. Thank you:

–pageField of rDatabase = Page Number from database program (entered as plain text)
–docName = Name of INDD file
–imageBox = Frame of INDD Page
–imagePath = Location of PDF file

set nPage to (pageField of rDatabase) as number
placeImageFile(docName, nPage, imageBox, imagePath)

on placeImageFile(xDoc, nPage, imageBox, imagePath)
set imagePath to imagePath as string
tell application “Adobe InDesign CS4”
if {Unicode text, string, number, integer} contains (class of xDoc) then set xDoc to document xDoc
if nPage is not equal to “” then set xDoc to page nPage of xDoc
tell xDoc
if {integer, string, Unicode text} contains {class of imageBox} then
try
set placeRef to page item imageBox
on error
set placeRef to page item imageBox of all page items
end try
else
set placeRef to imageBox
end if
end tell
tell placeRef
place imagePath
end tell
end tell
end placeImageFile

What do you see if you log (get pageField of rDatabase) and (class of (get pageField of rDatabase))?

I get value of the page from the database which is a number 1-72

The class of this is text. Which the script sets as number.

The class of nPage is integer and the value is corresponding to the value from (get PageField of rDatabase)

What is still confusing is how pages 1-10 are unaffected, but pages 11 and beyond are affected.

Hi,

maybe the problem occurs, because you coerce the page number to number (which is actually a floating point value) and then you check for empty string.
Try to coerce to integer and check for 0.