PDA

View Full Version : Read files



NewsArchive
03-09-2007, 06:57 AM
Friedrich,

up 'til now I've been reading the RED file like an INI file:

*.dll=C:\Program Files\SoftVelocity\Clarion 7\3rdParty\CapeSoft\EzHelp\Bin

but with the new Clarion7 RED file include statements, we'd like to only add
the RED include statement into the Clarion 7.red file:

{include %REDDIR%\ezHelp.RED}

and basically ship a preconfigured ezHelp.red file with ezHelp.

I need to check the Clarion70.RED file to see if it's there already, and if
not then add it to the end of the Clarion70.RED file. Ideally I could do
this with an ASCII type file - read in one line at a time, check if it
matches, if not continue reading until EOF. If not there, then add it to the
end of the file.

I can't figure out a way of doing this in SB6 - is it possible? If not, I'd
need to right this into an external DLL, but what happens about including
the ASCII driver for the file handling? How do I do this using an external
file?

Thanks
--
Geoff (Capesoft)

CapeSoft - where the computer obeys you!!
www.capesoft.com

NewsArchive
03-09-2007, 06:57 AM
Hi Geoff,

Yes, absolutely no problem. You can use the "Handle Text File
Operations..." script function to handle this.

1. Count Lines
2. Loop (number of lines comes from step 1)
3. Get Line and see if it matches.
4. If it is not already there (at the end), Insert Line

Does this help?

If you need an example, just let me know.

BTW, you can always create a LOCAL dll (so all required dependencies are
included, e.g. the ASCII driver) and call this from the SetupBuilder 6
installer. But in this case, no need to use such a DLL. "Handle Text
File Operations..." can do the job.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-09-2007, 06:57 AM
Hi Geoff,

I followed the C7 thread with regards to the new RED file include
statements.

I can add new functions to make this process easier. For example, a "Search
Text" function so we don't have to loop through the whole file.

Just let me know what you need and I'll add it.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
03-09-2007, 12:04 PM
you guys are shopping at walmart ? <G>

excellent service as usual Friedrich !

JP

--

Thank you

Jean-Pierre GUTSATZ

Best Regards

NewsArchive
03-09-2007, 12:04 PM
<G> :)

Friedrich

NewsArchive
03-12-2007, 08:25 AM
Friedrich,

Cool beans - that was exactly what I was after.

A small issue. You cannot seem to write to the end of the file. If there are
20 lines in the file, and you insert into line 20, then it inserts the
record before the previous line 20 (which now becomes line 21). If you
insert to line 21, then no insertion occurs. I worked around this by
duplicating line 20 (now 20 and 21), inserting the new line I want to insert
to position 21, and deleting line 22 (now the duplicate of line 20).

--
Geoff (Capesoft)

CapeSoft - where the computer obeys you!!
www.capesoft.com

NewsArchive
03-12-2007, 08:25 AM
Hi Geoff,

I'll check this...

Friedrich