My thoughts on multiple topics over the past few days


joy8388608
 

Forgive me for lumping several topics together. I wouldn't have time otherwise.

I, too, was in the same NoteTab beginner boat so I know what it feels like. Clipcode is quite unique but very predictable and usually easy to read when written clearly with comments. As a programmer who has had to learn many languages over the years, I hope I don't sound (fill in any one of several words) when I offer my advice which is to read the manual. Several times if you can. It's certainly not the most detailed or clear at times, but it does answer many questions I'm seeing, gives information and prevents surprise bugs because it is such a flexible language and loose on the syntax checking. And there are so many commands, I've often found some I didn't know about because of the information overload.

It is also VERY helpful to go through as much code (from other people) as you can find to learn new things that you missed in the help files or that weren't mentioned. I've learned a huge amount by doing that and by following discussions like this one.

I don't see it done often but don't see anything wrong with someone posting some code that works but seems long, obtuse or overly complicated and asking if someone knows how to rewrite it better. I'm sure many of the replies would be very educational.

Also, it's fine to ask if someone already has a clip to do one thing or another for ready to use or for a template.

On the topics of the last few days...

The manual does state
New since NoteTab 4.8: conditional commands now accept a command statement instead of a label.

---

Although it seems to work without quotes (I haven't tested), the syntax for IsAlpha requires quotes around the argument. Not using quotes may cause it not to work correctly in certain cases.

---

The IF statement cannot use logical arguments such as AND and OR.although there are ways I've written about several times to emulate this feature. Ask if you are interested and cannot find it.

---

A regexp way to replace the last comma in a string.
Lotta's way is easier to debug and understand. This way is shorter and for educational purposes because it was only recently I discovered regexp is permitted in StrReplace. (I still don't think well in regexp so I'm sure this can be improved upon)

^!Set %axel%=Goethe,Mann,Hesse
; ^!Set %pos%=^$StrPosRight(",";"^%axel%";false)$
; ^!Set %axel%=^$StrDelete("^%axel%";^%pos%;1)$
; ^!Set %axel%=^$StrInsert("&";"^%axel%";^%pos%)$
^!Prompt ^$StrReplace(",([^,]+)ZZZ";"\&$1";"^%axel%ZZZ";R)$

---

Regarding Help with Message boxes

I think I understand the question and I think useful answers were given but I'm not sure so here are my thoughts...

To process part of a file and stop to have it examined and then to continue, some things need be done. The first is to remember the location in the file where processing should restart from either with a bookmark or remembering the line and column. (Be careful the user doesn't toggle the WordWrap as this may cause a problem).
The next thing is to possibly check a variable at the start of the code to know if you need to position the starting point and to possibly skip any processing that only has to be done once and, therefore, was already done if this is a restart.

---

Braces and Brackets in Wizard:

From the manual
When input fields are defined using the square bracket format, the Wizard is displayed before the first Clip instruction is executed/evaluated. The Wizard is built from all such fields encountered in the script. That is how and why you may see multiple input fields in a single Wizard as soon as you click on the Clip while others using curly braces may take a little while to pop up.

In other words, curly braces pop up as they are found in the code. Square brackets are put together and shown all at once when the code starts even if they are scattered throughout the code and not at the beginning.

Joy

Join Clips@Notetab.groups.io to automatically receive all group messages.