copy scripts from one stack/card/controls to another stack

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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
istech
Posts: 126
Joined: Thu Sep 19, 2013 10:08 am

copy scripts from one stack/card/controls to another stack

Post by istech » Mon May 28, 2018 2:19 pm

Hi all,

I have a small query. I have a stack that I started developing in LC 7 and moved to LC 9. The upgrade process seemed to work fine until I needed to build a standalone a week later. The size doubled and I found inconsistencies in the functioning of the stack. So I am left with trying to revert or recreate the stack.

I want to know if it is possible to copy the scripts of each control on a card using a script to a different stack.

i.e stack 1 reads - on mouseup answer hi end mouseup
stack 2 reads before copy - on mouseup answer bye end mouseup
after copy stack 2 would read - on mouseup answer hi end mouseup

If this is possible this would save me a lot of time.

Thanks all.

Klaus
Posts: 10097
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by Klaus » Mon May 28, 2018 2:29 pm

Hi istech,

sure:

Code: Select all

...
set the script of btn "my cool button" of cd 1 of stack "the old new one" to the script of btn "the old cool button" of cd 44 of stack "the old stack"
...
If that is what you mean.


Best

Klaus

istech
Posts: 126
Joined: Thu Sep 19, 2013 10:08 am

Re: copy scripts from one stack/card/controls to another stack

Post by istech » Mon May 28, 2018 3:13 pm

Thanks Klaus,

I will give this a go now. This would also work with datagrids as well?

Klaus
Posts: 10097
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by Klaus » Mon May 28, 2018 4:47 pm

A datagrid is a much more complex and does not have scripts but behaviours and lots of dependencies. Not sure if this is easily doable.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4441
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by jacque » Mon May 28, 2018 6:36 pm

It would be easier to address the inconsistencies than to rebuild the stack. There were many changes between LC 7 and 9. What problems are you seeing? Also, the doubling of the app size may be due to standalone settings, depending on what platforms you are building for.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

istech
Posts: 126
Joined: Thu Sep 19, 2013 10:08 am

Re: copy scripts from one stack/card/controls to another stack

Post by istech » Mon May 28, 2018 8:23 pm

Thanks for the suggestions Jacque,

The most concerning problem was that the current v9 stack came up with an alert saying corrupt stack. Everything still works but I get some problems like some scrambled object ids, select object and getting a different object(checked ids are different), performance problems, externals not firing every time. Never had this in my original stack so made the decision to just update the scripts which will take a day to do. However, if I tried to do it the other route not sure what damage the stack has and would need to track it down which could take a while then depending on what it is may not be able to be fixed. So with this route at least I know where I stand. If you know any reason why an IOS stack would double in size on stand-alone please share I would like to investigate any options.

Thanks to you and Klaus for your help.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5960
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by FourthWorld » Mon May 28, 2018 8:30 pm

istech wrote:
Mon May 28, 2018 8:23 pm
The most concerning problem was that the current v9 stack came up with an alert saying corrupt stack.
In v9, or an earlier version expecting an earlier format?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4441
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by jacque » Mon May 28, 2018 9:17 pm

As Richard pointed out, if you save the stack in LC 9 and then try to open it in LC 7, you will get a "corrupted stack" message. That was confusing for users, so in LC 8 the message was changed to indicate that it can't open stacks saved with a newer version. I suspect that's what happened, if you tried to open the stack in LC 7 again.

Performance issues won't go away after a rebuild unless you address them. Usually native mobile controls are more responsive, but also some scripting techniques are slower than others. We'd need to know what is unsreponsive in your scripts.

If externals are not responding, make sure the inclusions list is correct. Turn off auto-check and include the externals manually. The standalone builder does not always find all the inclusions you need when doing its auto-scan.

Object IDs should not change, so I can only guess that the problem has to do with opening a LC 9 stack in LC 7. The same thing would affect any object selections.

The best way forward is to just work exclusively in LC 9. I have found it to be stable enough and the externals/inclusions have been optimized more than they were in LC 7. So has much of the text handling and scripting performance.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4441
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copy scripts from one stack/card/controls to another stack

Post by jacque » Mon May 28, 2018 9:22 pm

If you know any reason why an IOS stack would double in size on stand-alone please share I would like to investigate any options.
This is probably due to the dual engines included with an iOS build. There is one for 32-bit and another for 64-bit and the default is to include both. Standalone settings has an option to build only for 32-bit, which would bring the app back to its original size, but 64-bit is in use by most phones these days and the app will run better on those.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

istech
Posts: 126
Joined: Thu Sep 19, 2013 10:08 am

Re: copy scripts from one stack/card/controls to another stack

Post by istech » Tue May 29, 2018 5:10 pm

FourthWorld wrote:
Mon May 28, 2018 8:30 pm
istech wrote:
Mon May 28, 2018 8:23 pm
The most concerning problem was that the current v9 stack came up with an alert saying corrupt stack.
In v9, or an earlier version expecting an earlier format?
I wish that was the case. The first time I saw this alert was when I moved from a LC 9 Windows environment to a LC 9 MAC environment. Saying that I have not seen this error since.

I have tried several tests to see if there could be a stack issue. I created a simple rotate graphic script for both stacks. One is a newly created stack and the other was the original stack I have been developing on. The new stack worked as expected the other worked at half speed and malformed the graphic(new card). There was nothing else running in message watcher on both stacks. This I can not explain. If anyone can offer up a reason for this I would love to hear your thoughts.

Thanks Jacque for your suggestions as I have not done many projects in LC V8 & V9. I just find 7.1.4 to be a great version and I find it very stable for my needs. That being the case I would like to try out the new features with 9 so made the jump with this project but finding small problems here and there.

The doubling of the size of the standalone turned out to the be the extra slice you mentioned I wonder if 32-bit slice can be dropped? and only 64 bit slice used?

The issues with the object ids have not gone away and find only deleting the object and re-adding it seems to tame the problem.

I definitely will give LC 9 another go as I love the platform. Just not sure upgrading halfway through the development was the best way to go considering the issues I have hit.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”