Jump to content

Iniread()


Recommended Posts

  • Developers

Install the full SciTE4AutoIt3 package and hit F5 from SciTE.

This will run au3check for you and tell you what is wrong with the syntax.

Jos

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

  • Moderators

nht3004,

If you look at the error given in SciTE when you run your code, you see: "ERROR: IniRead() [built-in] called with wrong number of args".

Then in the Help file you see: "IniRead ( "filename", "section", "key", "default" )".

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OK, I've put in Default value, but these codes don't work, either:

Func doImport($fSource)
    If(StringRegExp($fSource, "[\\\w]+.snht", 0)==1) Then
        $ir=IniRead("temp.snht", "Hello", "There", "False");
        alert($ir);
    Else
        alert("Invalid path!");
        GUICtrlSetData($browseFileLink, "");
    EndIf
EndFunc

doImport("D:\info.snht");oÝ÷ ØÌ¢!bꮢÛ^'Ú®¢×(uïuée£ÝÓêÞ

I dont know why!

Please help me, I really stuck!

Edited by nht3004

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Link to comment
Share on other sites

  • Moderators

nht3004,

Ini File:

[hello]

There=This;

Your code:

IniRead("temp.snht", "Hello", "There", "False")

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nht3004,

Ini File:

[hello]

There=This;

Your code:

IniRead("temp.snht", "Hello", "There", "False")

M23

Oh, it's my mistake when I type, actually the word is Hello, but it does not work!

Here are my full scripts:

Ini file:

[Hello]
This=There

This code does not work:

Func doImport($fSource)
    If(StringRegExp($fSource, "[\\\w]+.snht", 0)==1) Then
        $ir=IniRead("temp.snht", "Hello", "There", "False");
        alert($ir);
    Else
        alert("Invalid Path!");
        GUICtrlSetData($browseFileLink, "");
    EndIf
EndFuncoÝ÷ Ø­¶¬Â䱫­¢+ÙÕ¹½%µÁ½ÉÐ ÀÌØíM½Õɤ($ÀÌØí¥Èõ%¹¥I ÅÕ½ÐíѵÀ¹Í¹¡ÐÅÕ½Ðì°ÅÕ½Ðí!±±¼ÅÕ½Ðì°ÅÕ½ÐíQ¡ÉÅÕ½Ðì°ÅÕ½Ðí±ÍÅÕ½Ðì¤ì(%±ÉÐ ÀÌØí¥È¤ì)¹Õ¹

It's weird!

Edited by nht3004

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Link to comment
Share on other sites

Finally, it works and I know what was wrong with me, I experience that when you use IniRead(Path), Path must be full like C:\My.ini, when you use IniWrite(Path), path must be a file name that is the same directory with your program!

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Link to comment
Share on other sites

  • Moderators

nht3004,

Personally, I always declare the ini file path at the beginning of the script and then use the variable in the IniWrite and IniRead statements:

Global $sIniFile = "full_file_path"
IniWrite($sIniFile,.....
IniWrite($sIniFile,.....

Solves the problem very neatly!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nht3004,

Personally, I always declare the ini file path at the beginning of the script and then use the variable in the IniWrite and IniRead statements:

Global $sIniFile = "full_file_path"
IniWrite($sIniFile,.....
IniWrite($sIniFile,.....

Solves the problem very neatly!

M23

Thanks for you exp, but why can't I use IniWrite with full path? It doesn't work, neither does IniRead without full path ^_^

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Link to comment
Share on other sites

It does work with full path ... Possibly you miss some slashes or use a wrong path ^_^

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

... why can't you use @scriptdir ? it works for me EVERY time.. or some other directory marco

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...