Indesign CS5.5 place image from main bundle ?


I have been using the below code to place a eps from the main bundle into my document, which has worked perfectly under Indesign CS5, how ever under CS5.5 the code will not compile.

If I comment out the middle line the code compiles, also if I delete the “as text”
the code will compile, but still fails to bring in the eps into my document.

How do I change the code to bring my eps into my document from the main bundle?

               set posixPath to current application's NSBundle's mainBundle's pathForResource_ofType_("G1 TEST", "eps") as string
               set posfile to (posixPath as text) as POSIX file
               set myNameFile to posfile as string

If you’re having compiling problems, it sounds like you’re doing that inside a tell application block – that’s not a good idea. Do it in a handler.

I can’t tell why the import isn’t happening because you’re not showing us the relevant code. But my guess would be that you want to place “alias myNameFile”.

thanks for that Shane

I just this minute changed this line

set posfile to (posixPath as text) as POSIX file

to this

set posfile to (posixPath as string) as POSIX file

changing text to string fixed the issue straight away, also found that changing to string
in this line of code worked also, if I used text xcode would not compile

else if button returned of _PP is "PP" then
                   choose from list {"072", "2747", "2757", "2767", "BLACK"} with prompt "Select Colour" default items {"072"} OK button name "Ok" cancel button name "Cancel"
                    --set the _Colour to result as text   --MUST CHANGE TO STRING -------
                    set the _Colour to result as string

using Xcode 4.0.1, OSX 10.6.8, Indesign CS5.5

That’s rather odd. I don’t have CS5.5, but it sounds like it (or something else) is doing something bad in terms of terminology.