Author Topic: Continuation character in WIL script  (Read 3004 times)

stevengraff

  • Sr. Member
  • ****
  • Posts: 271
Continuation character in WIL script
« on: January 23, 2014, 05:08:45 am »
Is there a way to break up a statement onto multiple lines (for "readability"), but still have it interpreted as if it were on a single line?


stanl

  • Pundit
  • *****
  • Posts: 777
Re: Continuation character in WIL script
« Reply #1 on: January 23, 2014, 07:49:46 am »
Define 'statement': do you mean a WB command, or something like an SQL statement that is 4-500 characters in length?

snowsnowsnow

  • Full Member
  • ***
  • Posts: 242
Re: Continuation character in WIL script
« Reply #2 on: January 23, 2014, 07:55:46 am »
I assume we are talking about a statement in a WB program (Note to readers: THis is a WinBatch forum, not a SQL forum, not a VB forum, and not a C forum).

And, in that case, the answer is "No."

The question has come up before.

stevengraff

  • Sr. Member
  • ****
  • Posts: 271
Re: Continuation character in WIL script
« Reply #3 on: January 23, 2014, 08:23:15 am »
OK; thanks.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Continuation character in WIL script
« Reply #4 on: January 23, 2014, 09:14:04 am »
WinBatch doesn't offer a "line continuation" character.

One technique is dealing with really long strings of data is to use the string concatenation operator to build a long string yet, still display the data so that it is readable.
Code: Winbatch
str = '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
str = str: '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
str = str:  '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
Deana F.
Technical Support
Wilson WindowWare Inc.

stanl

  • Pundit
  • *****
  • Posts: 777
Re: Continuation character in WIL script
« Reply #5 on: January 23, 2014, 10:06:40 am »
also useful if writing WB scripts using COM/CLR and talking to database tables with SQL [even though this is not a SQL Forum]
 
Code: Winbatch
 
cSQL='SELECT myfirstcolumn, mysecondcolumn, mythirdcolumn, myfourthcolumn, myfifthcolumn '
cSQL=cSQL:'mysixthcolumn,myseventhcolumn,myeighthcolumn,myninethcolumn,mycolumnthirty '
cSQL=cSQL:'FROM myfirsttable WHERE myeleventhcolumn="some value";'
;;;;.....
oConn.Execute(cSQL)
 

stevengraff

  • Sr. Member
  • ****
  • Posts: 271
Re: Continuation character in WIL script
« Reply #6 on: January 24, 2014, 12:50:48 pm »
Thanks; I've done that before. You're right, it's very usefull.

DAG_P6

  • Full Member
  • ***
  • Posts: 184
  • WinBatch rocks, and so does Wilson WindowWare!
    • WizardWrx
Re: Continuation character in WIL script
« Reply #7 on: January 25, 2014, 10:58:24 am »
Another place in which line continuation characters are extremely useful is in calls to functions that have long argument lists. Better yet would be the ability to insert line comments, as is often done in C and C++ code. I have seen, and written such calls that make good use of such inline comments to list the parameter names as they appear in the C/C++ header file in which the function is declared. This can be very handy when you think the actual arguments are out of order.

BTW, I know this isn't a C/C++ forum, but that doesn't preclude borrowing ideas from other languages, including C and C++, bearing in mind that the mere presence of a feature doesn't mean that everyone must use it.
David A. Gray
You are more important than any technology.

MiloradM

  • Newbie
  • *
  • Posts: 1
Re: Continuation character in WIL script
« Reply #8 on: June 01, 2018, 02:05:33 am »
I know this is old post, but I am new in WinBatch and I very miss possibility of splitting program lines into multiple lines.

Every programming language I know (except old Fortran, I think) have this possibility (I did work on more than 15 languages), and now I call WinBatch authors to implement such feature in their very good and useful product.

Or, maybe that feature was already implemented from last post in this theme?

stanl

  • Pundit
  • *****
  • Posts: 777
Re: Continuation character in WIL script
« Reply #9 on: June 01, 2018, 05:15:51 am »
There was a more recent thread about this where Jim asked about a StrCatEx() function and we discussed that versus delimiters, i.e. /* ….. */

And I believe Tony implemented something in WB, and I am sure he will chime in with how things turned out.

kdmoyers

  • Full Member
  • ***
  • Posts: 222
Re: Continuation character in WIL script
« Reply #10 on: June 01, 2018, 06:44:35 am »
It's not really "line continuation" but there is this feature for long strings:
Code: Winbatch
HeaderText = $"
This program takes a quote number and produces an estimate of freight price for
various services, IF it can find sufficient historical examples to estimate from.
You can deselect items that are not part of the estimate.
$"
This works well for me, as all my cases of too-long statements are really cases
of too-long strings.
The mind is everything; What you think, you become.