Jump to content
Sign in to follow this  
danusko

using txt or xls files

Recommended Posts

danusko

Hi all,

please can anyone show me just a little direction how can i creating this macro.

I want create a GUI function (this i know), which will be show any information. This info will be from a few files. (this i know too)

But i need reading the info according a condition. f.e. If is in this line in file number "5" then skip this info and go to read the next info. And if is this info "XY" write to this line on start "AAA". (i know write to the file only on end of file :)

can you help me?

Thanke you very much for .

Share this post


Link to post
Share on other sites
Gif

Hi all,

please can anyone show me just a little direction how can i creating this macro.

I want create a GUI function (this i know), which will be show any information. This info will be from a few files. (this i know too)

But i need reading the info according a condition. f.e. If is in this line in file number "5" then skip this info and go to read the next info. And if is this info "XY" write to this line on start "AAA". (i know write to the file only on end of file :)

can you help me?

Thanke you very much for .

Well

Case $msg = $fileopen
        $progopen = FileOpenDialog("Open", @desktopcommondir, "All files (*.*)")
            GUICtrlSetData($write, FileRead($progopen))

and

for bypassing or changing the letters readed in the file use StringReplace()

of cource it depends on what you want to read [ if ini or dld then iniread() and DLLcall ]

Edited by c4nm7

Share this post


Link to post
Share on other sites
Zedna

Hi from Czech to Slovakia :)

Look at my example, some texts I left in Czech you certainly will not have problem with it :)

$file_in = FileOpen('file1.txt', 0)
If $file_in = -1 Then
  MsgBox(0, "Chyba", "Nelze otevrit vstupni soubor.")
  Exit
EndIf

$file_out = FileOpen('file1.txt' & ".upr", 2)
If $file_out = -1 Then
  MsgBox(0, "Chyba", "Nelze otevrit vystupni soubor.")
  Exit
EndIf

$radek = 0
While 1
  $radek = $radek + 1
  $line = FileReadLine($file_in)
  If @error = -1 Then ExitLoop ; konec souboru

  If $radek = 5 Then ContinueLoop ; skip line 5

  $delka = StringLen($line)

  If StringLeft($line, 2) = 'XY' Then
    $line = StringLeft($line, 5) & Chr(9) & StringRight($line, $delka - 5) ; do some changes
  EndIf

  FileWriteLine($file_out, $line & @CRLF)
Wend

FileClose($file_in)
FileClose($file_out)

MsgBox(0, "HOTOVO", "Byl vytvoren vystupni soubor file1.txt.upr")
Edited by Zedna

Share this post


Link to post
Share on other sites
danusko

Hi radek,

super thanx for your help. I try it.

ps: ké bych u vedel s autoitom delat jak ty :)

kdyby to nelo, helfne mi jete? .)

Hi from Czech to Slovakia :)

Look at my example, some texts I left in Czech you certainly will not have problem with it :)

$file_in = FileOpen('file1.txt', 0)
If $file_in = -1 Then
  MsgBox(0, "Chyba", "Nelze otevrit vstupni soubor.")
  Exit
EndIf

$file_out = FileOpen('file1.txt' & ".upr", 2)
If $file_out = -1 Then
  MsgBox(0, "Chyba", "Nelze otevrit vystupni soubor.")
  Exit
EndIf

$radek = 0
While 1
  $radek = $radek + 1
  $line = FileReadLine($file_in)
  If @error = -1 Then ExitLoop ; konec souboru

  If $radek = 5 Then ContinueLoop ; skip line 5

  $delka = StringLen($line)

  If StringLeft($line, 2) = 'XY' Then
    $line = StringLeft($line, 5) & Chr(9) & StringRight($line, $delka - 5) ; do some changes
  EndIf

  FileWriteLine($file_out, $line & @CRLF)
Wend

FileClose($file_in)
FileClose($file_out)

MsgBox(0, "HOTOVO", "Byl vytvoren vystupni soubor file1.txt.upr")

Share this post


Link to post
Share on other sites
Gif

Hi radek,

super thanx for your help. I try it.

ps: kéž bych už vedel s autoitom delat jak ty :)

kdyby to nešlo, helfneš mi ješte? .)

:)

didn't i help, i meantioned FileRead() and StringReplace() though

anyway

edit: grammatical mistake !!!!!!!!!!!didnt i helpED!!!!!!!! lol

Edited by c4nm7

Share this post


Link to post
Share on other sites
Zedna

ps: kéž bych už vedel s autoitom delat jak ty :)

kdyby to nešlo, helfneš mi ješte? .)

Jasně. Když tak mi klidně pošli PM.

Zdravím

For english users: I like to help him :-)

Share this post


Link to post
Share on other sites
danusko

:)

didn't i help, i meantioned FileRead() and StringReplace() though

anyway

edit: grammatical mistake !!!!!!!!!!!didnt i helpED!!!!!!!! lol

Radek wrote mi it, more detaily. I can it use immediately and easier.

but you helped me too of course.

thanke you very much.

Share this post


Link to post
Share on other sites
Zedna

Hi radek,

super thanx for your help. I try it.

ps: kéž bych už vedel s autoitom delat jak ty :)

kdyby to nešlo, helfneš mi ješte? .)

I'm Zedna and not Radek :-)

Share this post


Link to post
Share on other sites
danusko

I'm Zedna and not Radek :-)

sorrry :) i saw in your script Radek and i thought its your nick :))))

absolut iracional :) but becomes :P

ps: uz som to tak trochu skúsal a vyzerá to very funkcne

dik

Edited by danusko

Share this post


Link to post
Share on other sites
Uriziel01

Little offtop i see ;P p.s-może zaczniemy jeszcze po Polsku gadac co wy na to chlopaki ? ;D


Share this post


Link to post
Share on other sites
Zedna

Little offtop i see ;P p.s-może zaczniemy jeszcze po Polsku gadac co wy na to chlopaki ? ;D

Czech/Slovak language is almost the same but Polish is little differrent for me - but I can understand it somehow (something from context).

But consider this is English forum and I don't know exactly if we can make here whole topics/post threads in other language.

If you want send me PM (English or Polish) ... :)

Share this post


Link to post
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
Sign in to follow this  

×