modify, copy, clone, folders and files, in stack, nonstack

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
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

modify, copy, clone, folders and files, in stack, nonstack

Post by reelstuff » Thu Sep 06, 2007 1:35 pm

Hi, everyone,

I need to copy a set of folders and files and then rename them based on user input.

I was looking at the import feature but it only allow the import of a text file or images ect.

I was wondering if there were a way to import a series of folders that contain files, like text or html files.

So this would be something like a template folder containing files of text or html

I was thinking I could save it as a non stack file but it would be easier if I could store them in a stack and just copy or clone the stack with the files in them.

(that may not be possible)

so if I have to save as a non stack file system, how would I reference this resource for scripting in revolution, here is an over view of what I am after.

copy or clone template then save in temp stack or data or folder ect.

then I would further process the contents of the folders and files using revolution.

Any thoughts on the best way to store this file system into stacks or externals?

Thanks in advance for your time.

Tim

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Sep 06, 2007 3:27 pm

Why not simply use some "shell" commands on OS X and/or Windows to copy one or more folders to a new location/name "on demand"?
Seems pretty easy and comfortable :-)

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Post by reelstuff » Thu Sep 06, 2007 8:52 pm

thank you yes, that may be a little above my head, but I will check into that,

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Fri Sep 07, 2007 9:26 am

Hi Tim,

as a start you could "peep" all the REV scripts for "revcopyfolder" etc.!
Button "revCommon" of cd 1 of stack "revlibrary" :-)

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Post by reelstuff » Fri Sep 07, 2007 12:39 pm

Yes, of course, I had never considered that before, thank you very much.

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

Post by Mark » Fri Sep 07, 2007 4:57 pm

Hi,

In those cases that you only want to move a folder to a different location, use the rename folder command.

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

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am

Post by mluka » Mon Sep 10, 2007 2:08 pm

Klaus wrote:Hi Tim,

as a start you could "peep" all the REV scripts for "revcopyfolder" etc.!
Button "revCommon" of cd 1 of stack "revlibrary" :-)
Hi, Klaus.

Ahem... Could you explain a bit exactly what you mean?

Thanks!
Michel
Montréal, Canada

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Mon Sep 10, 2007 3:10 pm

Short way:
Execute this code (for example in the message box):

Code: Select all

edit the script of Button "revCommon" of cd 1 of stack "revlibrary"
Long way:
Most of Rev's functionality is rev script, within revolution stacks. Normally the IDE hides those from you. However, you can change a setting to show them. In the Properties the General tab, select "Revolution UI elements appear in list of stacks". Then open the Application Browser from the Tools menu. There should now be many stacks with the prefix "rev" in the list.
:arrow: This is also one of the reasons why you should not name any of your stacks "Rev" at the beginning (for example "Revolving", or "Reverence").
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

TomStratton
Posts: 2
Joined: Mon May 05, 2008 12:29 am

Very old post with a new question...

Post by TomStratton » Thu May 08, 2008 11:41 pm

How did you discover that the revCopy command was on THAT button in THAT stack?

Once I knew where to look I found it OK but if I was hunting to find a command what would I do?

Also, do you know, if I want to replace this with a non-applescript version (say using a shell command) can I just replace it here or do I need to write my own version and put it in my stack?

Hope you're still out there...

Tom

BvG wrote:Short way:
Execute this code (for example in the message box):

Code: Select all

edit the script of Button "revCommon" of cd 1 of stack "revlibrary"
Long way:
Most of Rev's functionality is rev script, within revolution stacks. Normally the IDE hides those from you. However, you can change a setting to show them. In the Properties the General tab, select "Revolution UI elements appear in list of stacks". Then open the Application Browser from the Tools menu. There should now be many stacks with the prefix "rev" in the list.
:arrow: This is also one of the reasons why you should not name any of your stacks "Rev" at the beginning (for example "Revolving", or "Reverence").

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Fri May 09, 2008 9:14 am

Hi Tom,
How did you discover that the revCopy command was on THAT button in THAT stack?

Well, I like to tear things apart to see how they work, although "Curiosity killed the cat"...

That's how I started to learn MetaCard, which was the grandfather of Revolution and had almost NO documentation at all and that was in the days when I did not have internet access, must have been sometime in the last century ;-)
Once I knew where to look I found it OK but if I was hunting to find a command what would I do?
See above, no other idea...
Also, do you know, if I want to replace this with a non-applescript version (say using a shell command) can I just replace it here or do I need to write my own version and put it in my stack?
As long as your solution does work, you can change it there.
BUT with the next update it is gone again, so I would maybe create my own library stack and use it in my stacks.
Hope you're still out there...

I'm always around somehow :-)


Best

Klaus

TomStratton
Posts: 2
Joined: Mon May 05, 2008 12:29 am

Post by TomStratton » Sat May 10, 2008 1:29 am

Hi Klaus -

Thanks for the info. I was hoping that there was some kind of a search command that would look through all the rev stuff to find what you were looking for... javascript:emoticon(':?')

On another front... I am not understanding yet how to "reuse" code that I have created (I've only had the download for a few days). If I wanted to create TomCopy that hooked into other methods you suggest creating "my own library stack" but I'm not at all clear on how I would reference the command, where I would put the "library" code, etc. do you know of any good sources of information on this?

Thanks again
Tom
Klaus wrote:Hi Tom,
Also, do you know, if I want to replace this with a non-applescript version (say using a shell command) can I just replace it here or do I need to write my own version and put it in my stack?
As long as your solution does work, you can change it there.
BUT with the next update it is gone again, so I would maybe create my own library stack and use it in my stacks.
Best
Klaus
:?

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sat May 10, 2008 11:41 am

Hi Tom,

OK, creating and using your own libraries is pretty straightforward.

Creating:
1. Create a new stack and name it anyway you want (e.g. "my_shell_lib").
2. Put all your custom handlers and functions into the stack script.
3. Save it and that's your first library stack :-)

Using:
1. This can be scripted, maybe in the first stack of your standalone or whenever it is necessary like:
...
start using stack "my_shell_lib"
## This can be a substack or a separate file on disk,
## in that case you will have to provide the filepath,
## just llike any other stack
...

Done!

Now all the handlers/functions in the stackscript are available to all your other (sub-)stacks/cards/objects.
Cool, isn't it?! :-D

See "start using" in the docs.

You can remove that stack for the "message path" with:
...
stop using stack "my_shell_lib"
...

There is another nice thing that may come handy from time to time:
The engine will send a "librarystack" (see docs) message to the stack that you "start using..." when you "start using..."

This could be used for triggering some action linme initializing local/global variables etc., if necessary.

Have a nice weekend!


Best

Klaus

Post Reply