hello,
i am a newbie on Livecode.
Now i would like to create a Plugin. This Plugin do the following:
on Button click the Plugin create an new Card with Code.
I now how to create a blank (without Code) Card, but how to write code into new created Card?
The code is functions and commands like:
on myCommand
...
end myCommand
I hope that you can understand me, my English is not so good
arthurik
Howto create a new Card with Code
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Howto create a new Card with Code
Hi Arthurik,
There are several ways to do this. If you create a plug-in, probably it is a good idea to start your script with setting the defaultStack. After that, you can create cards etc. I'm assuming that your plug-in opens as a palette from the plug-ins menu.
This script creates a card that beeps when you click on it.
Now assume that you have a button "Template" in your plug-in:
There are many possibilities. If you give a little more information, we can find a better solution.
Kind regards,
Mark
There are several ways to do this. If you create a plug-in, probably it is a good idea to start your script with setting the defaultStack. After that, you can create cards etc. I'm assuming that your plug-in opens as a palette from the plug-ins menu.
Code: Select all
on mouseUp
set the defaultStack to the topstack
create card
set the script of it to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
end mouseUp
Now assume that you have a button "Template" in your plug-in:
Code: Select all
on mouseUp
put the script of btn "Template" into myScript
set the defaultStack to the topstack
create card
set the script of it to myScript
end mouseUp
Kind regards,
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Howto create a new Card with Code
Hello Mark,
thats it. Works great, thank you.
On this way I can read out a xml or a text file and write more code into the new Stack or Card.
arthurik
thats it. Works great, thank you.
On this way I can read out a xml or a text file and write more code into the new Stack or Card.
arthurik