Jump to content
Sign in to follow this  
magician13134

IniReadSection not finding Ini file or section... Both exist

Recommended Posts

magician13134

Ok, there may be something totally obvious I'm overlooking here, but this function isn't working, and I'm not sure what's going on... Does anyone see any problems with it?

loadBookmarks()

Func loadBookmarks($section = "Roots")
    Local $i
    Local $temp = IniReadSection("res\bookmarks.ini", $section)
    If not IsArray($temp) Then MsgBox(0, "Error!", "Could not find file!")
    For $i = 1 to $temp[0][0]
        If $temp[$i][1] == "folder" Then
            MsgBox(0, "", "Found folder: " & $temp[$i][0])
            loadBookmarks($temp[$i][0])
        Else
            MsgBox(0, "", $temp[$i][0] & " exists under " & $section)
        EndIf
    Next
EndFunc
;C:\Users\magician13134\Desktop\msi\software\Vanilla Browser\mockup\

[Roots]
Tech=folder
Random=folder
[Tech]
Digg=http://www.digg.com/
Google 42 - The Answer to Everything=http://www.google42.com/
Magic Soft Inc.=http://www.magicsofitnc.com/
[Random]
eBay=http://www.ebay.com/
Ladyada=http://www.ladyada.net/
Search Engines=folder
New Grounds=http://www.newgrounds.com/
[Search Engines]
Yahoo=http://www.yahoo.com/
Excite=http://www.excite.com/
Google=folder
[Google]
Web=http://www.google.com/
Images=http://images.google.com/
Video=http://video.google.com/
;C:\Users\magician13134\Desktop\msi\software\Vanilla Browser\mockup\res

Anything else I'm overlooking?

Thanks

Share this post


Link to post
Share on other sites
Valuater

This worked for me....

Dim $File = @ScriptDir & "\Times.ini"
loadBookmarks()

Func loadBookmarks($section = "Roots")
    Local $i
    Local $temp = IniReadSection($File, $section)
    If not IsArray($temp) Then MsgBox(0, "Error!", "Could not find file!")
    For $i = 1 to $temp[0][0]
        If $temp[$i][1] == "folder" Then
            MsgBox(0, "", "Found folder: " & $temp[$i][0])
            loadBookmarks($temp[$i][0])
        Else
            MsgBox(0, "", $temp[$i][0] & " exists under " & $section)
        EndIf
    Next
EndFunc

I am guessing its your "file location" thats the prob

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

.. anything else??? ...what are you seeing?

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
magician13134

Huh, still doing what it did before. I'm really puzzled!

Although, I added this line of code:

If FileExists($File) Then MsgBox(0, "", "File exists...")oÝ÷ Ø   ݶ­2È£!£.¥8^uçm+¡×ºÚ"µÍÙÐÞ
    ][ÝÉ][ÝËÐ^QÜ^J[TXYÙXÝ[Û[YÊ    ÌÍÑ[JJJ
and it just shows 0

That makes me think my Ini file is wrong... But what you see up there is what I have... Isn't that right?

Edited by magician13134

Share this post


Link to post
Share on other sites
MrCreatoR

Does anyone see any problems with it?

The only problem that i can predict here, is with relative path (res\bookmarks.ini)... use full path, or set working dir to script dir:

loadBookmarks()

Func loadBookmarks($section = "Roots")
    Local $sOld_WorkDir = @WorkingDir
    FileChangeDir(@ScriptDir)
    Local $temp = IniReadSection("res\bookmarks.ini", $section)
    
    If not IsArray($temp) Then MsgBox(0, "Error!", "Could not find file!")
    
    For $i = 1 to $temp[0][0]
        If $temp[$i][1] == "folder" Then
            MsgBox(0, "", "Found folder: " & $temp[$i][0])
            loadBookmarks($temp[$i][0])
        Else
            MsgBox(0, "", $temp[$i][0] & " exists under " & $section)
        EndIf
    Next
    
    FileChangeDir($sOld_WorkDir)
EndFunc
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Valuater

The only problem that i can predict here, is with relative path (res\bookmarks.ini)... use full path, or set working dir to script dir:

Thats what I thought/said too!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
twitchyliquid64

Huh, still doing what it did before. I'm really puzzled!

Although, I added this line of code:

If FileExists($File) Then MsgBox(0, "", "File exists...")oÝ÷ Ø   ݶ­2È£!£.¥8^uçm+¡×ºÚ"µÍÙÐÞ
    ][ÝÉ][ÝËÐ^QÜ^J[TXYÙXÝ[Û[YÊ    ÌÍÑ[JJJ
and it just shows 0

That makes me think my Ini file is wrong... But what you see up there is what I have... Isn't that right?

IT is possible the problem lies in the FAT, not the script. Try recreating the INI.

If you cannot isolate the problem, try going back to basics, then building from there.

Cheers,

Hypoz


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites
MrCreatoR

Thats what I thought/said too!

8)

Oops, sorry, i just read quickly the first and the last posts :)

magician13134

Maby the problem is in the path itself, the @ScriptDir inlude any non-ANSI characters? :)


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
magician13134

>.<

Sorry for wasting you time, guys, I had two Ini files in that folder and I was working with the other one... :)

Guh!

On a totally different note here, I love recursion! A year ago, I never could have gotten that working!

Edited by magician13134

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  

×