Jump to content

annoying problem


 Share

Recommended Posts

ok here is the problem that pisses me off :)

when my program is not compiled this command: _FileCountLines($Ose) returns the number of the file ive created without the extra one that is being added alone , so the return is 10 (the file is 11 lines but the last one is empty) and works perfectly

but when i compile the script _FileCountLines($Ose) returns 11 and even if i try to do _FileCountLines($Ose) - 1 it does the same thing !!!!!

how to resolve that???

it tried several workarounds but yet nothing....

PLEASE HELP

Link to comment
Share on other sites

but when i compile the script _FileCountLines($Ose) returns 11 and even if i try to do _FileCountLines($Ose) - 1 it does the same thing !!!!!

That doesn't make any sense

I understand that the 'running in Scite' and 'running compiled exe' return different values but the above statement is throwing me off.

Link to comment
Share on other sites

Hi,

#include<file.au3>
Dim $aRecords
_FileReadToArray('c:\found.txt',$aRecords) 
MsgBox(0,':::::::::::::' & UBound($aRecords), _FileCountLines('c:\found.txt'))

FileReadToArray works.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

i saw _filereadtoarray() but is a way bigger situation, i have about 10 stringsplit() and more

again the main problem is that _FileCountLines() returns the number of lines of file without THE LAST EMPTY ONE if not compiled but if compiled it returns

all the lines including the empty one

the file is like this:

LINE 1
LINE 2
LINE 3
LINE 4
LINE 5
LINE 6
LINE 7
LINE 8
LINE 9
LINE 10
-empty line-

so uncompiled script returns 10 and compiled 11

PS:if i could remove that empty line...

Link to comment
Share on other sites

Hi,

#include<Array.au3>
#include<File.au3>
Global $pfad = @ScriptDir & '\leerzeilen.txt', $lines_A
_FileReadToArray($pfad, $lines_A)
For $i = UBound($lines_A) - 1 To 1 Step - 1
    If Not StringRegExp($lines_A[$i], '[^\s]', 0) Then _ArrayDelete($lines_A, $i)
Next
_FileWriteFromArray($pfad, $lines_A, 1)


#include <Array.au3>
#include <File.au3>

Global $aSource
Global $path = "leerzeilen.txt"

If Not _FileReadToArray($path, $aSource) Then
    MsgBox(0, 'Achtung', "Datei konnte nicht eingelesen werden!")
    Exit
EndIf

_ArrayDisplay($aSource, "before...")
Global $tmp[1]

For $i = 1 To $aSource[0]
    If $aSource[$i] <> "" Then _ArrayAdd($tmp, $aSource[$i])
Next
$tmp[0] = UBound($tmp)
_ArrayDisplay($tmp, "after !")

So long,

Mega

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...