update filename of images

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

update filename of images

Post by jmburnod » Sat Jul 04, 2009 10:29 pm

Hi All,

I copy a stack on an other computer (from iMac intel Core Duo OSX 10.5.6 to PowerBook G4 10.4.2)

I watch the filename or images are updated automatically but if the image is in a group my stack keep the old filename.

Do you watch the same ?

Best regards

Jean-Marc

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

update filename of images

Post by jmburnod » Sat Jul 04, 2009 11:35 pm

I'm sorry,

i forget i write a script for update filename of a list of images.

Regards

Jean-Marc

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Post by shadowslash » Sun Jul 05, 2009 7:05 am

Hi jmburnod,

I think it would be much easier to understand what your problem is if you post a portion of your code here. Image
Parañaque, Philippines
Image
Image

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

update filename of images

Post by jmburnod » Sun Jul 05, 2009 10:06 am

Hi Shadowslash,

Thank you for support

This script to update a filename work :

Code: Select all

function fChgPathNec pFi  -- (pFi is the filename to update)
   put empty into rfChgPathNec
   put "LeNecessaire" into MonSubFol
   put the filename of this stack into MyPathS
   put the itemdel into myOID
   set the itemdel to "/"
   put the num of items of MyPathS into nbD
   put the num of items of pFi into nbO
   put item 1 to nbD-1 of MyPathS into MyPathFolD
   put itemOffset(MonSubFol,pFi) into bufOffNec
   put item bufOffNec to nbO  of pFi into bufPathKeep
   set the itemdel to  myOID
   put MyPathFolD&"/"&bufPathKeep into rfChgPathNec
   return rfChgPathNec
end fChgPathNec
All the best

Jean-Marc

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm

Post by Bernard » Tue Jul 07, 2009 4:45 pm

Hi Jean-Marc

Let me restate your problem (as I understand it). You are trying to change the filenames of image controls in your stack. The function you listed is what you use to produce the new file path & name. This script works, but not if the image is in a group.

Is that correct?

I just called the function listed here, and when I passed it a file path & name, the path returned by your function was invalid (it contained "//" at one place instead of "/").

Bernard

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Post by jmburnod » Wed Jul 08, 2009 10:58 pm

Hi Bernard,

Thank for this feed-back
Let me restate your problem (as I understand it). You are trying to change the filenames of image controls in your stack
This script works, but not if the image is in a group.
Is that correct?
Yes, you understand me
No. I tested it now and it work also with an image of a group
I just called the function listed here, and when I passed it a file path & name, the path returned by your function was invalid (it contained "//" at one place instead of "/").
I dont have a double "/" [/quote]
Maeby it is because you haven't a subfolder "LeNecessaire" in the folder it contains the stack (it define the part of path to keep)

Jean-Marc

Post Reply