Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TEXT ... ENDTEXT question
Message
De
04/04/2008 13:05:17
 
 
À
04/04/2008 09:55:44
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01307554
Message ID:
01308276
Vues:
13
>Certainly you have a choice. Remove the semicolons! :)
>lcDoThis = chrtran(m.lcDoThis,';','')

I don't think it's the semicolons. It's the CRLF put in by TEXT/ENDTEXT
lcDoThis = chrtran(m.lcDoThis,';'+CHR(13)+CHR(10),'')

UPDATE: Didn't realize Cathy had posted essentially the same (but better since it included TABS) solution


Actually, I don't see any reason for the semicolons at all.
>Now trying to build a multi-line command:

But this isn't really building a multi-line command (meaning more than one line of code is being executed). It's splitting one line of code on multiple lines of display. The semicolons are not needed
TEXT TO lcDoThis NOSHOW
   cmsg = 'A' + 
   'B'+ 'C'
ENDTEXT
lcDoThis = CHRTRAN(lcDoThis,CHR(13)+CHR(10),"")
&lcDoThis
>>OK thanks, but I don't have the choice. This gives an error (but the Execscript works fine).
>>
>>cmsg = ''
>>TEXT TO lcDoThis NOSHOW
>>     cmsg = 'A' + ;
>>     'B'+ 'C'
>>ENDTEXT
>
>Certainly you have a choice. Remove the semicolons! :)
>
>lcDoThis = chrtran(m.lcDoThis,';','')
>
>>&lcDoThis
>>*Execscript(lcDoThis)
>>Messagebox(cmsg)
>>
>>
>>
>>>Execscript is slower than &.
>>>
>>>>>>I want to build a long command line.
>>>>>>
>>>>>>This works OK:
>>>>>>
>>>>>>TEXT TO dothis
>>>>>>cmsg = 'A' + 'B'+ 'C'
>>>>>>ENDTEXT
>>>>>>
>>>>>>&dothis
>>>>>>?cmsg
>>>>>>
>>>>>>
>>>>>>Now trying to build a multi-line command:
>>>>>>
>>>>>>
>>>>>>
>>>>>>TEXT TO dothis
>>>>>>cmsg = 'A' + ;
>>>>>>'B'+ 'C'
>>>>>>ENDTEXT
>>>>>>
>>>>>>&dothis
>>>>>>?cmsg
>>>>>>
>>>>>>
>>>>>>This gives an error (with or without the semi-colon). Is there a way to build up a command over more than one line?
>>>>>>Cyril
>>>>>
>>>>>Don't use macro substitution. Use EXECSCRIPT() instead:
>>>>>
>>>>>TEXT TO lcDoThis NOSHOW
>>>>>     cmsg = 'A' + 'B'+ 'C'
>>>>>     MessageBox(cmsg)
>>>>>ENDTEXT
>>>>>EXECSCRIPT(lcDoThis)
>>>>>
>>>>
>>>>Thanks for the EXECSCRIPT() suggestion. This works:
>>>>
>>>>cmsg = ''
>>>>TEXT TO lcDoThis NOSHOW
>>>>     cmsg = 'A' + ;
>>>>     'B'+ 'C'
>>>>ENDTEXT
>>>>Execscript(lcDoThis)
>>>>Messagebox(cmsg)
>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform