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
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 6:44 am
Hello
I wrote following code lines in the mainstack.
Code: Select all
on openStack
revCopyFolder "AA","CC"
end openStack
I receive error message: can't find handler.
forgot I something?
Pascal
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Tue May 12, 2015 11:04 am
From the dictionary
During the first part of the application's startup process, before this message is sent, the revCopyFolder command is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCardhandlers in the main stack.
Once the application has finished starting up, the library is available and the revCopyFolder command can be used in any handler.
You also need to declare the full paths of the folder you are trying to copy and its destination...
-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Tue May 12, 2015 12:38 pm
Hi Passcal,
I think the reason for the error ist eh way LC load all libraries etc. in a standalone
and all these are NOT ready yet "on openstack"!
So you will need to add a little "delay" like this to give LC the time to load everything:
Code: Select all
on openStack
send "do_the_copy" to me in 100 millisecs
end openStack
command do_the_copy
revCopyFolder xxxxx,yyyyy
end do_the_copy
Best
Klaus
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Tue May 12, 2015 12:41 pm
I think, Klaus, it would be better to use 'send' in the oipenCard handler, rather than in openStack... as you don't know what tasks have to be performed in the openCard handler that might take more time than you have allowed send to delay from an openStack handler...

-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Tue May 12, 2015 12:54 pm
I always put my "openstack" handler into the script of the first card!
But yes, depending on the scripts "opencard" would be a good place for this.
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 1:30 pm
Hi Dixie.
Thank you to this details.
However I didn't understand how I had managed to make it.
I have just noticed that this script error ( or Impossibility) is automaticly corrected in a standalone application.
It's strange, isn't it?
Good afternoon.
Pascal
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 1:34 pm
Thank you Klauss.
I am going tested at once
Pascal
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 2:00 pm
Hi Klaus.
I tested it's perfect even into the mainstack.
Is this approach valid to other cases?
Among others, every time there is an type error: "can't find handler" ?
Pascal
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Tue May 12, 2015 2:36 pm
Hi.
Klaus made a very subtle, but very powerful point. By placing the handler in the card script, he is pretty sure that the stack has fully opened and all resources are loaded, since cards are drawn, and their messages sent, "long" after the stack has loaded. To Dixie's point, this "delay" is inherent in the process of loading stack elements, and therefore not dependent on an arbitrary time delay, which could be either too long, which is wasteful, or too short, which is useless.
Craig Newman
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 3:54 pm
Hi Craig
Thank you for this explanation.
Now I ask me an other question:
if to place the handler in the card script guarantees a full opening of stack,
when to favor stack, even mainstack, ( except the interest of cards set)?
Pascal
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Tue May 12, 2015 4:45 pm
Hi.
If I understand your question, I suppose you can place handlers in the stack script if they do not require very many loaded resources. Where the line between openCard and openStack should be drawn is not clear, I think. I know it is more logical and comforting to place an openStack handler in the stack script, as opposed to the card script. But the process in LC is not instantaneous. You might learn to play it safe, and always use the card script.
You could even use an openCard handler in the card script of the first card, and be assured this will open even later.
Craig
-
pascalh4
- Posts: 81
- Joined: Thu Aug 22, 2013 12:50 pm
Post
by pascalh4 » Tue May 12, 2015 5:04 pm
Hi
Thank you for your clarification.
I have taken note of it.
Pascal