So what IS the "expected type" (specifically InDesign)

This one is really bothering me, because I can’t understand what is really wrong, AND I work in InDesign all the time and this has never not worked before. BUT I’m calling a script from Objective-C, and that seems to work fine overall (or not?) In my script class I have 2 methods so far. One method gets the contents of a text frame on an InDesign document. The other is trying to place an image onto the first page of the document. The first method works great. The other method is getting called and goes through all the steps except the “place” command is giving me this error:

*** -[ScriptMethods placeImgInDoc:codeDestination:]: Can’t make «class page» id 191 of «class sprd» id 186 of document id 3 of application “Adobe InDesign CS5” into the expected type. (error -1700)

In a very shortened nutshell here’s the code I’m using:

Objective-C
[asocScripts placeImgInDoc:[url path] codeDestination:fullString];



on placeImgInDoc_codeDestination_(imageURL, codeLoc)
		
		tell me to log imageURL
		tell me to log codeLoc
		
		set imageURL to POSIX file imageURL
		set codeLoc to codeLoc as string
		
		tell application "Adobe InDesign CS5"
			if exists document 1 then
				tell document 1	
					tell page 1
						display dialog "6"
						set someResult to place imageURL place point {0, 0} showing options no with properties {label:codeLoc}
						display dialog "7"
						--adding a label to the object results in 
						--the IMAGE not the frame getting a label
						set label of parent of item 1 of someResult to "qrCode"
						display dialog "9"
						
					end tell
				end tell --document 1
			end if --exists document 1
		end tell
		
	end placeImgInDoc_codeDestination_

Hi,

POSIX file should be used as coercion


 set imageURL to imageURL as POSIX file

If you often have to pass HFS paths, I recommend this method as a category of NSString


- (NSString *)HFSPathFromPOSIXPath 
{
    CFStringRef hfsPath = CFURLCopyFileSystemPath((CFURLRef)[NSURL fileURLWithPath:self], kCFURLHFSPathStyle);
	
	/* To support GC and non-GC, we need this contortion. */
	return [NSMakeCollectable(hfsPath) autorelease];
}


Aaahhh yes. OK I remember reading that in Shane’s book, doing sort of “backwards” coercion.
I had to do:

set imageURL to (imageURL as string) as POSIX file
Works now.
THANKS!