Jump to content

Recommended Posts

Posted (edited)

Any idea why it does not read next line on EGL.LIST file ? :/ 


Ex : 

 

#include <file.au3>
;Local For Looper Increment Function
$lineset = 1
$n = 1
;Locals for email list
$LEGL = "EGL.LIST" ;EGL ( EMAIL GENERATOR LIST | LEGL LOCATION EMAIL GENERATOR LIST)
;Open File And Read It
Local $hLEGL = FileOpen ($LEGL, $FO_READ)
;hLEGL variable to setup external file reading
;Read File
Local $EGLL = FileReadLine($hLEGL,$lineset)

Call("increment")

 
func increment()
   While $n = 1
   $lineset = $lineset + 1
;Debuger
MsgBox($MB_SYSTEMMODAL, "", "EGL LINE : " & @CRLF & $EGLL)
; EGL1 EMAIL GENERATOR LIST LINE
MsgBox($MB_SYSTEMMODAL, "", "Line: "  & @CRLF & $lineset) ; Line Set = value of line reader
WEnd
Edited by LHCompter
Posted

You dont have the line that reads in the loop..

#include <file.au3>
;Local For Looper Increment Function
$lineset = 1
$n = 1
;Locals for email list
$LEGL = "EGL.LIST" ;EGL ( EMAIL GENERATOR LIST | LEGL LOCATION EMAIL GENERATOR LIST)
;Open File And Read It
Local $hLEGL = FileOpen ($LEGL, $FO_READ) ;hLEGL variable to setup external file reading
;Read File
Local $EGLL = FileReadLine($hLEGL,$lineset)

Call("increment")

func increment()
While $n = 1
$lineset = $lineset + 1
;Debuger
$EGLL = FileReadLine($hLEGL,$lineset) ;<<<<<<<<<<<<<<
MsgBox($MB_SYSTEMMODAL, "", "EGL LINE : " & @CRLF & $EGLL) ; EGL1 EMAIL GENERATOR LIST LINE
MsgBox($MB_SYSTEMMODAL, "", "Line: "  & @CRLF & $lineset) ; Line Set = value of line reader
WEnd
EndFunc

A better way to do this would be to count the lines and do a "for" loop to the count number.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

In case u're interested in what i meant:

 

#include <file.au3>

;Local For Looper Increment Function
$lineset = 1
$n = 1
;Locals for email list
$LEGL = "EGL.LIST" ;EGL ( EMAIL GENERATOR LIST | LEGL LOCATION EMAIL GENERATOR LIST)
;Open File And Read It
Local $hLEGL = FileOpen ($LEGL, $FO_READ) ;hLEGL variable to setup external file reading
;Read File
Global $Count = _FileCountLines($LEGL)

ReadLines()

Func ReadLines()
For $n=1 To $Count
$EGLL = FileReadLine($hLEGL,$n)
ConsoleWrite($EGLL &@CRLF)
;MsgBox($MB_SYSTEMMODAL, "", "EGL LINE : " & @CRLF & $EGLL) ; EGL1 EMAIL GENERATOR LIST LINE
;MsgBox($MB_SYSTEMMODAL, "", "Line: "  & @CRLF & $lineset) ; Line Set = value of line reader
Next
EndFunc

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

If you're going to read the file sequentially, this way is much faster.

#include <file.au3>

;Locals for email list
$LEGL = "EGL.LIST" ;EGL ( EMAIL GENERATOR LIST | LEGL LOCATION EMAIL GENERATOR LIST)
;Open File And Read It
Global $hLEGL = FileOpen($LEGL, $FO_READ) ;hLEGL variable to setup external file reading
;Read File
;~ Global $Count = _FileCountLines($LEGL)

ReadLines()

Func ReadLines()
    While 1
        $EGLL = FileReadLine($hLEGL)
        If @error <> 0 Then ExitLoop
        ConsoleWrite($EGLL & @CRLF)
        ;MsgBox($MB_SYSTEMMODAL, "", "EGL LINE : " & @CRLF & $EGLL) ; EGL1 EMAIL GENERATOR LIST LINE
        ;MsgBox($MB_SYSTEMMODAL, "", "Line: "  & @CRLF & $lineset) ; Line Set = value of line reader
    WEnd
EndFunc   ;==>ReadLines

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Aweomse methods but is there any way to call the value from that read line ?

For example to call first line and after it finishes his job with that line to autoincrement and call the next line from the same file

Posted

Not sure i got the question right.

Do you really mean increment, or maybe it's concatenate?

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Well for example I want that the program make this thing

first he reads the line so in values that will be 

$line1
$file = "file.txt"

after he reads that line I want that he make a msgbox  and say "hi the line 1 : this is line one"

after that  I want he ingrese the lines so that will be 

$line1 = $line + 1
$file = "file.txt"

msgbox ( "hi this is line 2 : this is line two)

and I want that he loops this procese :/ 

Posted

@careca It's dramatically inefficient to first invoke _FileCountLines() then have a For loop using that count with a FileReadLine($h, $n) to read $n-th line!

With this you are doing all of the following block N+1 times if the files has N lines:

  • open the file,
  • read the file,
  • split the file in lines,
  • close the file.

Better use @BrewManNH code or FileReadToArray() and read in the array.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

I thought it was, if anything, at least as efficient.

Never timed it to know for sure.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

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