Automating placement of referenced image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Automating placement of referenced image
I have a stack of cards, each card of which has the picture of a courtroom as the background. A judge's bench is in the center. The court has seven judges. Each card has fields that contain data about a particular case that one of the seven judges decided. I have a script that automatically creates the cards from a text file and puts the textual data about the case into the fields of each card. On each card I have been manually putting a picture of the judge who decided the case by using New Referenced Control -> Image. I am looking for a script that will automatically put a referenced picture of the correct judge at the correct location on the card when the card is created and the fields are populated, e.g., in English, if the judge is "Smith," put image "pics/Smith.png" at the correct location. I searched the forum and saw, set the filename of "image" to "smith.png", but what not sure what the object named "image" is. Image Area? Please forgive if I overlooked an existing discussion. Thanks you for any suggestions.
Monty
Monty
Re: Automating placement of referenced image
Hi Monty,
wrong syntax, the object descriptor is missing, so it should read:
Which will surely answer your question
But you would rather:
Best
Klaus
Code: Select all
## set the filename of "image" to "smith.png"
Code: Select all
set the filename of IMAGE "image" to "smith.png"

But you would rather:
Code: Select all
set the filename of IMAGE "image" to "pics/smith.png"

Best
Klaus
Re: Automating placement of referenced image
But what is the object referred to as IMAGE in the example and that has the name "image"? Is it an "image area", which is one of the tools on the tools pallette?
Monty
Monty
Re: Automating placement of referenced image
Hi.
Would you have the same problem understanding this:
set the loc of "button" to "100,100"
This is missing the object descriptor, as Klaus says. Do you immediately see the issue?
The missing descriptor could be a name, a number, an ID, whatever:
set the loc of button 2 to "100,100"
set the loc of button "XYZ" to "100,100"
now hear this:
set the loc of button "button" to "100,100"
It is probably not good practice to use the default object name, but cannot hurt unless you let it. But in the example using "image", the case is the same. Don't let the name similarities get to you. But do know the difference.
Craig Newman
Would you have the same problem understanding this:
set the loc of "button" to "100,100"
This is missing the object descriptor, as Klaus says. Do you immediately see the issue?
The missing descriptor could be a name, a number, an ID, whatever:
set the loc of button 2 to "100,100"
set the loc of button "XYZ" to "100,100"
now hear this:
set the loc of button "button" to "100,100"
It is probably not good practice to use the default object name, but cannot hurt unless you let it. But in the example using "image", the case is the same. Don't let the name similarities get to you. But do know the difference.
Craig Newman
Re: Automating placement of referenced image
Monty,
Yes, it is an object you drag over from the ToolBar. "image" is the name of the object you wish to set to "pics/smith.png". Expanding on the answer, I created (which you may also do programmatically) an Image object named "MyPic". In a button I put:
Note that this may resize the image object, so you will have other tuning to do.
Yes, it is an object you drag over from the ToolBar. "image" is the name of the object you wish to set to "pics/smith.png". Expanding on the answer, I created (which you may also do programmatically) an Image object named "MyPic". In a button I put:
Code: Select all
ask file "Get image file"
if it is not empty then
set the filename of image "MyPic" to it
end if
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Automating placement of referenced image
Thank you Klaus, dunbarx, and WaltBrown. I now understand how to automate the importation and placement of images of my judges, and If I set the correct image size of my photos in my photo editor, I won't need to scale them with code in the script.
Monty
Monty