au3scr Posted May 14, 2008 Share Posted May 14, 2008 How i can get idea how many lines in specific section? How i can get what is written in line? here is my ini That pi planned for my next script How to get how many things are under install? and how to get their names? I need return like Howmany = 2 Names= firefox ;thunderbird and if i remove 1 of them then at howmany return will be 1 [general] HideGUI=0 [install] firefox thunderbird Link to comment Share on other sites More sharing options...
au3scr Posted May 14, 2008 Author Share Posted May 14, 2008 OMG no one knows it? Do some one know if it can be done with autoit? (if no one answers, i can suppose that i cant be done with autoit. Link to comment Share on other sites More sharing options...
d2addict4 Posted May 14, 2008 Share Posted May 14, 2008 Anything can be done with AutoIt. It's just either no-one has seen your topic, or is just a too simple question, they aren't answering. IniReadSection, can be used to find the number of things, and then change that into a int. Simple AutoIt Point Of Sale Link to comment Share on other sites More sharing options...
au3scr Posted May 14, 2008 Author Share Posted May 14, 2008 but IniReadSection returns always 1, how i get other variables? It is not written in help Link to comment Share on other sites More sharing options...
d2addict4 Posted May 14, 2008 Share Posted May 14, 2008 It returns an array. IniReadSection -------------------------------------------------------------------------------- Reads all key/value pairs from a section in a standard format .ini file. IniReadSection ( "filename", "section" ) Parameters filename The filename of the .ini file. section The section name in the .ini file. Return Value Success: Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value. Failure: Sets @error=1 if unable to read the section (The INI file may not exist or the section may not exist) Remarks A standard ini file looks like: [sectionName] Key=Value The number of elements returned will be in $result[0][0]. If an @error occurs, no array is created. Only the first 32767 chars are taken in account in an section due to Win9x compatibility. Related IniDelete, IniWrite, FileReadLine, IniRead, IniReadSectionNames, IniRenameSection, IniWriteSection Example $var = IniReadSection("C:\Temp\myfile.ini", "section2") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) Next EndIf Simple AutoIt Point Of Sale Link to comment Share on other sites More sharing options...
au3scr Posted May 14, 2008 Author Share Posted May 14, 2008 I cant get this example work. It returns Error occurred, probably no INI file. or my modified version returns >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\My Documents\installbot\install.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>00:35:05 Starting AutoIt3Wrapper v.1.10.1.7 Environment(Language:0409 Keyboard:00000425 OS:WIN_XP/Service Pack 2 CPU:X86) >Running AU3Check (1.54.10.0) from:C:\Program Files\AutoIt3 +>00:35:06 AU3Check ended.rc:0 >Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "Z:\My Documents\installbot\install.au3" Z:\My Documents\installbot\install.au3 (8) : ==> Subscript used with non-Array variable.: For $i = 1 To $var[0][0] For $i = 1 To $var^ ERROR ->00:35:06 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 2.344 ------------------------------------------------------------- msgbox (1,"",fileexists ("install.ini")) returns 1 Link to comment Share on other sites More sharing options...
enaiman Posted May 14, 2008 Share Posted May 14, 2008 (edited) Code please ... and ini file structure You get that error there because there is no such array$var[0][0] : IniReadSection failed and no array was created. Without code I can't see how somebody could help. Edited May 14, 2008 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now