Macro like record function

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Macro like record function

Post by jalz » Fri Apr 18, 2014 5:04 pm

Hey all,

As I'm a newbie and still learning LiveCode I'd love to have some sort of record facility like there is for Microsoft Macros. The record facility would record the events a user does within a card/stack and then generate a script corresponding to the user actions.

The user can then edit the automated scripted output and clean out the bloat or any unnecessary steps.

Just my 2 pence worth.

All the best
Jalz

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10081
Joined: Fri Feb 19, 2010 10:17 am

Re: Macro like record function

Post by richmond62 » Fri Apr 18, 2014 5:36 pm

I'm not entirely sure how that would help you learn Livecode.

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

Re: Macro like record function

Post by FourthWorld » Fri Apr 18, 2014 7:01 pm

Systems like MS' macros require that every feature in the software be written with the intention of allowing recordability. Not impossible in LiveCode, but also not trivial.

In some contexts it's possible to use built in language features like frontScripts, mouseControl, and others to approximate some types of activity recording, but even these are made problematic by the inherent flexibility of the LiveCode language, since an author of one stack may write scripts that respond to messages in ways that are completely different from another, where details about the context of the execution, both in terms of objects at the moment and the workflow over time, can alter behavior.

My own explorations in this have been for automated testing, in which I spent only enough time to get around special challenges like handling modal dialogs but not enough to handle the critical part of results evaluation; that is, making sure that a given set of actions didn't merely not crash, but resulted in a specific outcome. I haven't yet invested the time needed to complete that last aspect, as it's a bit of work to do gracefully.

Most generalized automated testing tools take a different approach, looking only at the pixels as a representation of outcomes. Eggplant is a good example, and FWIW uses a similar language for its scripting:
http://www.testplant.com/eggplant/

For learning, over the years I've seen many different learning styles attempted, with widely varying results. I can appreciate the desire to see auto-generated scripts describing interactions, but as you learn more about LiveCode, and programming in general, I think you'll come to appreciate how such output would often differ quite starkly from the actual code used within the program being recorded.

So if the goal is to learn how to write programs in LiveCode, the best way I've seen yet is to dive in and start writing.

Start small with something simple, like reading a text file into a field and being able to save the changed text back out to the file.

Then you could add to that to support text styles, outputting formats in things like RTF, adding menus to handle text editing features, and even if you never make the world's greatest text editor you'll have learned a lot along the way.

While you're writing, read other people's code too. Some code in the community is complex, and may be difficult for newcomers to grasp readily. But there are also many examples written specifically with newcomers in mind - consider the lessons at LiveCode.com:
http://lessons.runrev.com/

In fact, there are so many examples aimed at newcomers (72 of them are included in the LiveCode installation - click the Resources button in the toolbar) that you may be able to find one that fits your particular interests. You can make a copy of it, explore the code, look up any syntax that's new to you in the Dictionary, and modify it to explore new things you can do with the language.

There are many useful things that can be done with macros, but learning about the programming language the macro system was written with isn't their strongest value.

To learn LiveCode, write LiveCode. Start small, build over time, and when you have questions you've already taken the first step in learning by joining these forums.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10081
Joined: Fri Feb 19, 2010 10:17 am

Re: Macro like record function

Post by richmond62 » Fri Apr 18, 2014 8:22 pm

I find it very interesting how people who come to Livecode from other programming languages [unlike people who come to Livecode
never having programmed before] almost always look for features that were present in previous languages they used in Livecode.

It is good to know, despite its 25+ year ancestry that Livecode is iconoclastic insofar as it is rather different from both 3G languages such as FORTRAN and C,
and other 4G languages.

Personally, having studied Visual BASIC as part of a Master's program, I found it to be BASIC with a rather inadequate 4G Object Based front-end jammed on the front,
and at the price of losing what was so good about BASIC when I worked with it in 1976-1988.

To get along with Livecode it is probably best, initially at least, to try to forget one's preconceptions, and just "get stuck in", and see what it offers, rather than expecting what your previous languages had.

Livecode is deceptive: it looks simple and simplistic: it is neither.

I wish you great joy (and a lot of learning and adaptation) in your journey with Livecode.

Post Reply