Page 1 of 1 1
Topic Options
#178520 - 2007-07-27 05:53 PM load then read text from RAM
ledzepe Offline
Fresh Scripter

Registered: 2005-12-06
Posts: 26
Hi everyone,

I have script that compares the invoice number that I inputed to a text file that contains unprocessed invoice numbers. When the inputed number match with one of the unprocessed invoice, a voice message would play.

However the list of unprocessed invoice number grew so large that it takes a while for the script to go through the list. Is there a way to put the list in the memory or RAM so that it will run faster? The file or list is on the local drive.

We're running this script on older P2 Win98 PCs and the invoice numbers are barcoded so we just scan the barcode.

Top
#178521 - 2007-07-27 06:24 PM Re: load then read text from RAM [Re: ledzepe]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe one of the ReadFile() functions can help you?
Top
#178522 - 2007-07-27 07:28 PM Re: load then read text from RAM [Re: Witto]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
AFAIK, when KiX opens a file, it reads it all into memory. If you have a performance issue, you are probably hitting the pagefile and need more memory.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#178542 - 2007-07-30 09:25 AM Re: load then read text from RAM [Re: Les]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Try and provide a little more information, it will help us work out what solution best fits your needs:
  1. How many invoices are you talking about?
  2. How are you doing the check to see if the invoice is in the file?
  3. Are the invoices sorted in the file before you start?
  4. How / when is the program run?
  5. Can you post your code?

Top
#178544 - 2007-07-30 09:47 AM Re: load then read text from RAM [Re: Richard H.]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Perhaps the FileSystem Object would help out here, you can read 1 line at a time with that. Although like Les said, this will open the entire file in memory too but I like to think FSO handles files quicker then Kix does.

 Code:
Dim $Script, $FSO, $ReadScript
$Script = "C:\boot.ini"
$FSO = CreateObject("Scripting.FileSystemObject")
$ReadScript = $FSO.OpenTextFile($Script, 1)
While Not $ReadScript.AtEndOfLine
  ? $ReadScript.ReadLine
Loop
$ReadScript.Close
$FSO = ""

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.049 seconds in which 0.015 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org