Missing 'on' does not cause error...

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Missing 'on' does not cause error...

Post by [-hh] » Thu Apr 17, 2014 5:50 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:35 pm, edited 1 time in total.
shiftLock happens

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Missing 'on' does not cause error...

Post by Thierry » Thu Apr 17, 2014 6:04 pm

[-hh] wrote:@Thierry
have you time to make a small stack with your "clean" solution (-> LC share)?
Would be great, because this is also be valuable/usable for other languages (python/perl) and hard to find here.
For example on the RaspberryPi there are readymade python libs for using the GPIOs and one could then use your technique to script & call this from LC.
Well, sure I could but I'm not sure this is a generic solution yet.
BTW, you have all the code in my previous post!

Do you have some practical examples to send me?
and I could add one sample working with regex too.

Regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Missing 'on' does not cause error...

Post by jacque » Thu Apr 17, 2014 10:13 pm

It's kind of funny, we used to store data in scripts this way all the time in HyperCard. HC had few storage options and even the Apple developers did it in their sample stacks.

Now we've come full circle, and LC users have "discovered" the feature. :) I routinely comment out the "on" line to disable a whole handler. It's easier than selecting all the text.

One caveat though: if you have strict compilation mode turned on, it will fail. That's one reason I don't use it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Missing 'on' does not cause error...

Post by [-hh] » Fri Apr 18, 2014 12:50 am

Nothing circular here, because this is not detected, but learned, also from *your* work.

If you are new to LC, then this is the only way to learn fast: to see what people did with limited resources, to see the tricks they used, what else? HC-Archives are still available. And then use LC and you know what you are doing with all these meanwhile available wonderful tools.

But from these old scripts you learn pretty fast also 'not recommended' things. Or should I say 'forbidden' things (Craig, you know what I mean)? And you are still doing such things jacque? Clandestinely?
shiftLock happens

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Missing 'on' does not cause error...

Post by FourthWorld » Fri Apr 18, 2014 1:15 am

I used to store data in scripts in HyperCard only because it had no custom properties, so there was no other way to bind arbitrary data to them. With SuperCard's and LiveCode's support for custom properties I haven't resorted to that in decades.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Missing 'on' does not cause error...

Post by [-hh] » Fri Apr 18, 2014 1:40 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:34 pm, edited 1 time in total.
shiftLock happens

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Missing 'on' does not cause error...

Post by FourthWorld » Fri Apr 18, 2014 2:01 am

[-hh] wrote:Congratulations and thanks, that you are willing to do this important and time eating job.
Thank you for the kind words. So far it's not bad at all. On the contrary, it's exciting to lend a hand seeing where this LiveCode phenomenon can take us all.
p.s. I'm sometimes told to look also in other lists (use-list).
Do you see any chance that the community could join on ONE single market place? Or is this, from some reason, no good idea?
Many folks are on both, but really they cater to two different sets of preferences so I think they'll remain two separate things. Or at least I hope so. Some folks prefer to have everything go into their In Box with the discussion list, others like the freedom to choose the topics they want to read here in these Web forums. I'd hate to see either go away, and both are open to everyone so we all get what we most prefer.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Missing 'on' does not cause error...

Post by [-hh] » Fri Apr 18, 2014 2:21 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:34 pm, edited 1 time in total.
shiftLock happens

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Missing 'on' does not cause error...

Post by Thierry » Fri Apr 18, 2014 8:21 am

[-hh] wrote:@Thierry
... because this is also be valuable/usable for other languages (python/perl) and hard to find here.
For example on the RaspberryPi there are readymade python libs for using the GPIOs and one could then use your technique to script & call this from LC.
Hermann,

If you are still interested in integrating "external scripts" inside livecode scripts,
I suggest to start a new thread with an appropriate title or contact me off-forum...

Kind regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Missing 'on' does not cause error...

Post by [-hh] » Fri Apr 18, 2014 10:55 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:34 pm, edited 1 time in total.
shiftLock happens

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Missing 'on' does not cause error...

Post by Thierry » Fri Apr 18, 2014 11:37 am

[-hh] wrote:
... integrating "external scripts" inside livecode scripts ...
Bonjour Thierry,
I'm very interested, especially if you are engaged.
:)
Perhaps it makes sense to start with a *simple* goal, that beginners can easily follow?
Well, I don't think this topic is for beginners. (we are on the experienced developers forum)
I would recommend them to follow Richard or Jacque advices.. :roll:
.... How is this done with applescript or specials on other platforms? How with Python, Perl or PHP?
All this integrated in an LC script?
The technic I've shown above will work for any languages you want to deal within Livecode.
Script it in and with your livecode script without any addition of extra and numerous "\" & and quote which
makes most of the script *unreadable*, making them hard to debug and maintain.

If you have a specific already made script, I can rewrite it for you with pleasure.

Regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Missing 'on' does not cause error...

Post by jacque » Fri Apr 18, 2014 4:41 pm

And you are still doing such things jacque? Clandestinely?
LOL. Only the part where I comment out the handler first line. Like Richard, I haven't had to store data in scripts for ages. But I wouldn't say it's forbidden, only that it isn't the most efficient way to keep data in a stack because of the parsing you have to do to get it out. I did think using an item delimiter was clever though, I never thought of that.

Usually when I want to store scripts I put those in custom properties too. In Thierry's example I would have put the whole AppleScript in one.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Missing 'on' does not cause error...

Post by Thierry » Fri Apr 18, 2014 6:34 pm

jacque wrote:
Usually when I want to store scripts I put those in custom properties too. In Thierry's example I would have put the whole AppleScript in one.
Jacque,
I like having a "Perl/AS/Shell/Python" script strongly connected to a livecode handler all at the same place.
Find much much easier to read and debug and copy/paste to share with others.

Plus, as I'm coding in an external editor,
the property inspector palette is not available.

And finally, the commented script is also automatically copied in a custom property.

Different background, experience and style :)

Regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Missing 'on' does not cause error...

Post by jacque » Fri Apr 18, 2014 7:33 pm

Yup. There is nothing wrong with your method, Thierry. As you say, just different styles. I can see the advantages if you are using an external editor.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Missing 'on' does not cause error...

Post by Simon Knight » Fri Apr 18, 2014 11:03 pm

Hi,
I have just found this thread and am loving some of the ideas (well the ones I understand!). The script posted by hh posting the text of the first 10 rows to the message box is going to be so useful but...... how can it be used with a datagrid ? I placed it in the script area of the group but it extracts and posts data from each of the column elements which is not quite as useful.

Simon K

Belay the above, I realised all that is needed is to replace "the target" with "me" and it works as desired.
best wishes
Skids

Post Reply