Page 1 of 1

openStack handler

Posted: Tue May 12, 2015 6:44 am
by pascalh4
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

Re: openStack handler

Posted: Tue May 12, 2015 11:04 am
by Dixie
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...

Re: openStack handler

Posted: Tue May 12, 2015 12:38 pm
by Klaus
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

Re: openStack handler

Posted: Tue May 12, 2015 12:41 pm
by Dixie
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...:-)

Re: openStack handler

Posted: Tue May 12, 2015 12:54 pm
by Klaus
I always put my "openstack" handler into the script of the first card! :D

But yes, depending on the scripts "opencard" would be a good place for this.

Re: openStack handler

Posted: Tue May 12, 2015 1:30 pm
by pascalh4
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? :roll:

Good afternoon.

Pascal

Re: openStack handler

Posted: Tue May 12, 2015 1:34 pm
by pascalh4
Thank you Klauss.
I am going tested at once

Pascal

Re: openStack handler

Posted: Tue May 12, 2015 2:00 pm
by pascalh4
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

Re: openStack handler

Posted: Tue May 12, 2015 2:36 pm
by dunbarx
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

Re: openStack handler

Posted: Tue May 12, 2015 3:54 pm
by pascalh4
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

Re: openStack handler

Posted: Tue May 12, 2015 4:45 pm
by dunbarx
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

Re: openStack handler

Posted: Tue May 12, 2015 5:04 pm
by pascalh4
Hi

Thank you for your clarification.
I have taken note of it.

Pascal