Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro substitution error (maximum statement length?)
Message
From
05/10/1999 14:14:19
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00272599
Message ID:
00272833
Views:
40
>>>>Hello All,
>>>>
>>>>I've got a problem with the macro (&) substitution. I've got a table with error messages that call some program functions. These error messages are executed with a macro like:
>>>>
>>>>lcMacro = table.errorcommand
>>>>lctext = &lcMacro
>>>>messagebox(lctext)
>>>>
>>>>Where table.errorcommand is a memo field.
>>>>
>>>>The problem is that with long error messages (>255 chars) this will not work anymore. I've seen a reference in the manual that sais "The string in the macro command cannot exceed the maximum statement length. BUT there is no actual number on how long the maximum statement length is.
>>>>
>>>>So my question is: Does anyone know what the max. statement length is and also some suggestions on how to solve this problem would be much appriciated.
>>>>
>>>>TIA,
>>>>
>>>>Wim Dieke
>>>
>>>Had a similar problem recently and was offered a simple solution here on the UT. Create a temp file and push the command out to the temp file. Then run the temp file as a program. If you are using VFP 6, StrToFile() will make this easier, if not, let me know as I have a VFP 5.0 program that emulates these commands. Using your statements, it would be something like this:
>>>
>>>cFileName = SYS(3) + '.PRG'
>>>StrToFile(table.errorcommand, cFileName)
>>>DO &cFileName
>>>ERASE &cFileName
>>
>>You have to have VFP 6 SP3 to do this, because earlier versions did not make the COMPILE command available at run time.
>
>Absolutely correct, good point. But if you do:
>cFileName = SYS(3) + '.PRG'
>StrToFile(table.errorcommand, cFileName)
>lcCmd = FileToStr(cFileName)
>DO &lcCmd
>ERASE &cFileName
>
>It should work provided you have a VFP 5.0 program to emulate the FileToStr and StrToFile commands.

Maybe I am missing something, but that just takes you back to where you began. Actually it won't work, even with short commands, because now you are executing a line that says:

DO MESSAGEBOX("sometext")

But even if you take out the "DO", and execute the line by itself, you are still going to run into the same limit you ran into before.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform