Macro

Macro

Postby Jeff Barnes » Fri Nov 17, 2017 1:41 pm

I'm playing around with an idea (using FWH and xHarbour).

I have a text file, in this file I want to put some code.

Sample code (not the code in the text file):

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

Function Main()
   LOCAL cText:=MemoRead("myfile.txt")
   &cText
Return Nil
 


The above works if the text file has:
Code: Select all  Expand view  RUN
MsgInfo('Hello World')


If I change the text file to have:
Code: Select all  Expand view  RUN
IIF( EMPTY(cText), MsgInfo('cText is empty'), MsgInfo('cText is NOT empty')  )

It also works.

Now, if I have the following in my text file it does not work (generates an error: Syntax Error &):

Code: Select all  Expand view  RUN
IF EMPTY('cText')
   MsgInfo('cText is empty')
ELSE
   MsgInfo('cText is NOT empty')
ENDIF


Any ideas?

It's not easy to explain why I want to do this but I will give it a shot...

I am importing data from many different medical systems.
I have a config file that let's me setup start/end points to grab data, something like:
<STARTDATE>10/10/2017</STARTDATE>
<STARTTIME>11:49AM</STARTTIME>

Some systems will have the data a little different:
<STARTDATE>10/10/2017 11:49AM</STARTDATE>

So both date and time are in the same segment.

So I was thinking, in my config file I could have a memo field for each item that would allow me to have code so I can strip out the date and the time if they are in the same segment.

This is a very basic example but I hope it gives the right idea as to what I'm trying to do.
I'm trying to stay away from hard coding some of this so it will be easy to add more systems that I can import from.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Macro

Postby Armando » Sat Nov 18, 2017 12:34 am

Jeff:

what if you remove the apostrophes?

Code: Select all  Expand view  RUN

IF EMPTY('cText')
 


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Macro

Postby Jeff Barnes » Sat Nov 18, 2017 12:01 pm

That was a typo, I didn't actually have the quotes around cTest:

IF EMPTY(cTest) is what I actually have.

I'm working on switching over to Harbour to try out the scripting features but I'm getting compile errors (started another post regarding this).
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Otto and 71 guests

cron