Jump to content

IniRead problem


Recommended Posts

Dim $i = 0
For $i = 1 To 100 Step 1
    $file = IniRead("Files.log", "Encrypted Files", $i, "END")
    If $file = "END" Then $i = 101
    Dim $szDrive, $szDir, $szFName, $szExt
    $TestPath = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt)
    MsgBox(0, "", $szFName)
    GUICtrlCreateListViewItem(($szFName & "|" & $szExt & "|" & $file), $tab1list)
Next

I can not get IniRead to work with a variable ($i) although i can get IniWrite to work with a variable, am i doing something wrong, $file is always END as if the key wasnt there

The Ini File is like this

[Encrypted Files]
1=C:\Test\Test.txt
2=C:\Test\Test2.txt
and so on

EDIT: I can't even get it to work if I use 1 or "1" as key so i take it my code is wrong

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

i don't know i just stuck it in after i got problems

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • Developers

Dim $i = 0
For $i = 1 To 100 Step 1
    $file = IniRead("Files.log", "Encrypted Files", $i, "END")
    If $file = "END" Then $i = 101
    Dim $szDrive, $szDir, $szFName, $szExt
    $TestPath = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt)
    MsgBox(0, "", $szFName)
    GUICtrlCreateListViewItem(($szFName & "|" & $szExt & "|" & $file), $tab1list)
Next

I can not get IniRead to work with a variable ($i) although i can get IniWrite to work with a variable, am i doing something wrong, $file is always END as if the key wasnt there

The Ini File is like this

[Encrypted Files]
1=C:\Test\Test.txt
2=C:\Test\Test2.txt
and so on

EDIT: I can't even get it to work if I use 1 or "1" as key so i take it my code is wrong

Code works fine .....

Are you sure about the ini filename or have you changed the working directory ?

Try changing the inifile to @scriptdir & "\files.log"

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

why do you use "Dim $i = 0" $i = 0 is enaugh... Dim is only for arrays...

this statement doesn't make much sense to me.

But A for...next loop will declare the variable with a LOCAL scope.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

$i = 0
$szDrive = ""
$szDir = ""
$szFName = ""
$szExt = ""
For $i = 1 To 100 Step 1
    $file = IniRead("Files.log", "Encrypted Files", $i, "END")
    If $file = "END" Then $i = 101
    $TestPath = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt)
    MsgBox(0, "", $szFName)
    GUICtrlCreateListViewItem(($szFName & "|" & $szExt & "|" & $file), $tab1list)
Next

works on my computer perfect

Link to comment
Share on other sites

I don't know what I was doing wrong but It works now.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
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...