Jump to content

Problem with _FileWriteToLine


Recommended Posts

hello all,

here's my code, take a look please.

#include "File.au3"

$ini = "Test.ini"
$Release_File = FileReadLine($ini, 2)
$Release_File_Size = FileGetSize($Release_File)
$test = _FileWriteToLine("Test.ini", 1, $Release_File_Size, 1)

then it replaces the first line correctly with "blah test"..

any idea what i am doing wrong? the help file isnt helping me.. lol

Link to comment
Share on other sites

#include <File.au3>

$ini = @MyDocumentsDir & "\test.ini"
$Release_File = FileReadLine($ini, 2)
$Release_File_Size = FileGetSize($Release_File)
IniWrite($ini,"test section",0,$Release_File_Size)

change your inifile to look like this.

[test section]

0=123456678

1=test..exe

2=test_123.exe

Link to comment
Share on other sites

#include <File.au3>

$ini = @MyDocumentsDir & "\test.ini"
$Release_File = FileReadLine($ini, 2)
$Release_File_Size = FileGetSize($Release_File)
IniWrite($ini,"test section",0,$Release_File_Size)

change your inifile to look like this.

[test section]

0=123456678

1=test..exe

2=test_123.exe

Link to comment
Share on other sites

hello all,

here's my code, take a look please.

#include "File.au3"

$ini = "Test.ini"
$Release_File = FileReadLine($ini, 2)
$Release_File_Size = FileGetSize($Release_File)
$test = _FileWriteToLine("Test.ini", 1, $Release_File_Size, 1)

then it replaces the first line correctly with "blah test"..

any idea what i am doing wrong? the help file isnt helping me.. lol

If the file Test.exe doesn't exist or it's size is zero then you will be trying to write a line 0, or a null string, so nothing will happen. Maybe that's the problem.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

martin,

the file size is not 0, its 300+ kb

Aceguy,

i didnt want to use the ini functions because i dont want it to have [sections] =/. the size has to stay in first line

OK, then change your line to

$test = _FileWriteToLine("Test.ini", 1, String($Release_File_Size), 1)

otherwise yu are trying to write a number as a string.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...