Sign in to follow this  
Followers 0
RazerM

IniRead problem

7 posts in this topic

#1 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Edited by Lord_Doominik

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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"


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
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.

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  
Followers 0