Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
cmhjon
- Posts: 190
- Joined: Tue Aug 04, 2015 11:55 am
Post
by cmhjon » Tue Jun 20, 2023 6:51 pm
Hi all,
I am trying to script the process of importing an image, rotating it to a different angle, reducing its size, and then setting its location. The script worked perfectly until I added the line to change its rotation angle. Here's the script as I have it so far:
Code: Select all
on mouseUp
answer file "Select a JPEG file:"
put it into filePath
import paint from file filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
put the loc of graphic "placeHolder" into tLoc
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp
After adding the line to set the rotation angle, the image gets rotated to the specified angle but then seems to ignore the remaining commands.
What am I missing?
Thank you,
Jon

Last edited by
cmhjon on Tue Jun 20, 2023 8:06 pm, edited 1 time in total.
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Tue Jun 20, 2023 7:30 pm
Hi.
I did not recreate the various files you mentioned, merely starting from the rotation step with an arbitrary image and proceeding as you did.
No issues, no degradation of the image.
Mac.
Craig
-
cmhjon
- Posts: 190
- Joined: Tue Aug 04, 2015 11:55 am
Post
by cmhjon » Tue Jun 20, 2023 8:08 pm
Hi Craig,
I am stumped. If I remove the angle command line, the script works perfectly but with the angle command in place, the image size is not reduced in size nor is it repositioned as instructed.
Best regards,
Jon
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue Jun 20, 2023 8:17 pm
Hi Jon,
try to set the lockLoc of the image to true
Code: Select all
set the lockLoc of image tFileName to true -- add this line
set the angle of image tFileName to 270
Kind regards
Bernd
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Tue Jun 20, 2023 8:17 pm
I just made a new post:
https://forums.livecode.com/viewtopic.php?f=9&t=37986
In it, I cheat, and simply import a JPEG from the menubar. If I set its angle to some value, I can then set its loc, but neither of its width or height. The size and position pane in the inspector shows the "lock size and position" checkbox as unchecked.
Craig
-
cmhjon
- Posts: 190
- Joined: Tue Aug 04, 2015 11:55 am
Post
by cmhjon » Tue Jun 20, 2023 8:22 pm
Hi Bernd,
I had just tried that before I saw your reply and yes, that did the trick!
Thanks everyone!
Jon

-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Tue Jun 20, 2023 8:30 pm
Bernd.
My question is this: If one sets the angle of an image, one can no longer change its width or height. The lockLoc property is irrelevant.
Craig
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue Jun 20, 2023 8:32 pm
dunbarx wrote: ↑Tue Jun 20, 2023 8:30 pm
Bernd.
My question is this: If one sets the angle of an image, one can no longer change its width or height. The lockLoc property is irrelevant.
I think you have to set the lockLoc to true before setting the angle. Then you can change to dimensions of the image afterwards.
Kind regards
Bernd
-
cmhjon
- Posts: 190
- Joined: Tue Aug 04, 2015 11:55 am
Post
by cmhjon » Tue Jun 20, 2023 8:48 pm
Here is the updated script which now works:
Code: Select all
on mouseUp
put the loc of graphic "placeHolder" into tLoc
answer file "Select a JPEG file:"
put it into filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
import paint from file filePath
set lockLoc of image tFileName to true
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp
Best regards,
Jon
