[SOLVED] end if

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

Post Reply
anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

[SOLVED] end if

Post by anmldr » Wed Sep 19, 2012 6:16 pm

I am accustomed to writing "endif" and not "end if". Is there a way to put a constant that would do the text substitution for me if I make that mistake. I could put the script in all of my new projects until I get accustomed to "end if".

Linda
Last edited by anmldr on Thu Sep 20, 2012 3:23 pm, edited 1 time in total.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: end if

Post by Klaus » Wed Sep 19, 2012 6:35 pm

Hi Linda,

not build-in and not an easy task to script, but why not just use the FIND & REPLACE feature of Livecode
to replace "endif" with "end if" after you completed your scripts??


Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: end if

Post by sturgis » Wed Sep 19, 2012 8:47 pm

You could try the glx2 editor. While it doesn't have the endif end if conversion built in there is a system to handle that type of change. I don't recall the name of the feature off the top of my head but basically its a way to setup macros that will do the changes on compile. There are a few already written, but the only one I remember at the moment is the ability to set variable values using the more common methods.

i = 1

This is automagically converted to lc type syntax. (I think you have to turn this functionality on)

Worth a look at least.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: end if

Post by mwieder » Wed Sep 19, 2012 9:04 pm

It's the glx2 preprocessor mechanism for macros, and it's there by default. You can turn it off, but otherwise it just sits in the background until you compile.

That said, I just added "endif" to the preprocessor, and while it works, it does screw up the script formatting. I'll see what I can do.

Meanwhile, Linda, just get used to typing "end if". I feel your pain here because I'm constantly typing "endif" myself and having to correct it.

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Re: end if

Post by anmldr » Thu Sep 20, 2012 12:35 am

I can definitely get used to "end if". The question though was a general one for text substitution for something like #define in XCode.

Linda

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: end if

Post by mwieder » Thu Sep 20, 2012 12:41 am

Well, I've got mixed feelings about macros in general. You can get into weird problems with macros that are hell to debug.

But no, there isn't a #define construct. The closest thing is to use a constant, and that won't work for substituting keywords.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: end if

Post by sturgis » Thu Sep 20, 2012 12:43 am

How about typinator? Not free, but super useful anyway. http://www.ergonis.com/products/typinator/

A pretty good text expander, and if I recall correctly you can set expansion rules to be program specific.

Post Reply