from a mainstack to substack of an other mainstack

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

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:

from a mainstack to substack of an other mainstack

Post by jmburnod » Mon Jun 14, 2010 5:29 pm

I have a substack "LeMagasin" in a mainstack "MyMainstack" and an other mainstack "AllImages"

The stack "AllImages" contains one cd with 36 images

The substack "LeMagasin" contains 36 cds with one image in each cds

I need to set the text of image 1 of each cd of substack "Lemagasin" to the text of img n (n=1 to 36) of stack "AllImages"

This script dont work i have one error :
Error description: Chunk: no such object

I'm sur it is possible to do that more simple

Thank in advance for your help

Jean-Marc

Code: Select all

on ImpImDeOld
   global MonStack,MagStack,LeStack,gDev   
   put empty into gDev
   set the lockmessages to true
   put "MagImagesEtRef" into LaCD
   put the filename of this stack into MonStack
   put "LeMagasin" into MagStack
   answer file "Importer de :"
   if it = empty then 
      exit ImpImDeOld
   end if
   put it into LeStack --•• i select the stack  "AllImages"
   
   open inv cd  LaCD of stack leStack
   put the num of images of cd  LaCD of stack leStack into nb
   repeat with i = 1 to nb
      put the short name of img i of cd LaCD of stack LeStack into bufLeNom
      put SansSuffixe(bufLeNom) into LaCDdest
      put LaCDdest&return after gdev
      
      --All ways return one error message : Chunk: no such object without comment
      
      -- set the text of img 1 of cd LaCDdest of stack MagStack of stack MonStack to the text of img LeNom of cd LaCD of stack leStack
      -- set the text of img 1 of cd LaCDdest of stack MagStack  to the text of img LeNom of cd LaCD of stack leStack
      put the text of img LeNom of cd LaCD of stack leStack into vTextIm
      open stack MonStack
      open cd LaCDdest of stack MagStack
      set the text of img 1 of cd LaCDdest of stack MagStack to  vTextIm
      wait 2 milliseconds with messages
      --•• All ways return one error message END
   end repeat
      set the lockmessages to false
end ImpImDeOld
https://alternatic.ch

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: from a mainstack to substack of an other mainstack

Post by Mark » Wed Jun 16, 2010 9:25 am

Hi Jean-Marc,

The following should work:

Code: Select all

on ImpImDeOld
  go inv stack "path/to/stack/AllImages.rev"
  repeat with n = 1 to 36
    set the text of img 1 of cd n of stack "LeMagasin" to the text of img n of cd 1 of stack "AllImages"
  end repeat
end ImpImDeOld
If it doesn't, please post the exact error message here.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

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

Re: from a mainstack to substack of an other mainstack

Post by jmburnod » Wed Jun 16, 2010 6:32 pm

Hi Mark,
Thank for reply

I'm sorry, the problem is resolved (an error of me at "put the text of img LeNom" instead "put the text of img i")

Best

Jean-Marc
https://alternatic.ch

Post Reply