Input a reference, search for this and place in InDesign script

Hello!

Im trying to make a script with the follow coordinates.

  • User input an info.
  • Script search for an image with this info.
  • After, place in inDesign this image.

I don’t know what is wrong in my script, but his return this information.

error “Can’t get alias \input info" of alias "path that indesign search for the input info".” number -1728

This is my script.


set originalFolderPath to choose folder with prompt "Please locate the folder" 
tell application "Adobe InDesign CC 2017"
	set myDialog to make dialog
	tell myDialog
		set name to "Test"
		set myDialogColumn to make dialog column
		tell myDialogColumn
			set myBorderPanel to make border panel
			tell myBorderPanel
				set myDialogColumn to make dialog column
				tell myDialogColumn
					make static text with properties {static label:"Reference:"}
				end tell
				set myDialogColumn to make dialog column
				tell myDialogColumn
					set myTextEditField to make text editbox with properties {edit contents:"", min width:180}
				end tell
			end tell
		end tell
	end tell
	set myResult to show myDialog
	if myResult is true then
		tell application "Adobe InDesign CC 2017"
			set myNameFile to edit contents of myTextEditField
			set myDocument to active document
				tell myDocument
				set noColor to swatch "None"     
				set myRectangle to make rectangle with properties {fill color:noColor, stroke color:noColor, geometric bounds:{0, 0, 10, 10}}
				tell myRectangle
					place alias (myNameFile) of originalFolderPath on myRectangle
				end tell     
				fit myRectangle given proportionally 
				fit myRectangle given center content 
			end tell
		end tell
	end if
	destroy myDialog
end tell

Your place command is incorrectly looking for the alias of an alias. An alias can’t be concatenated, without first being coerced to text. This would work, assuming your file is at the expected location; an alias can only point to an extant object.

place alias (((originalFolderPath as text) & myNameFile)) on myRectangle

Thanks! But a got a syntax error:

Expected “,” but found application constant or consideration.

What is this?

I see no reason for that error with my suggestion. If you changed nothing else, it’s possible your version is unhappy with the double document reference that precedes your if consideration. I would advise getting rid of the second “tell application” line and its corresponding “end tell”.