Hi all, Thanks Jeff your a star that does it. This one has been holding me up for at least 3 days. Cheers Warm regards. Martin Webster.
--- On Thu, 2/9/12, Jeff Weiss <[email protected]> wrote: > From: Jeff Weiss <[email protected]> > Subject: RE: help with the INIFile object > To: [email protected] > Date: Thursday, February 9, 2012, 3:13 PM > After creating the Test.ini file, try > this. > Notice "MyIniFile" > Jeff Weiss > > > ' Test.vbs > ' [Bosses] > ' boss1=Doug > ' boss2=Dan > ' [Support] > ' name1=Mike > ' name2=Raul > ' name3=Aaron > > Dim MyHotkey : Set MyHotkey = > Keyboard.RegisterHotkey("Control-Shift-Windows-i", > "ReadIni") > > Sub ReadIni() > Set MyIniFile = IniFile(ClientInformation.ScriptPath & > "\test.ini") > iniString = MyIniFile.GetSectionNames() > > iniArray = Split(iniString, vbNullChar) > For Each iniName In iniArray > Speak iniName > Next > End Sub > > -----Original Message----- > From: martin webster [mailto:[email protected]] > > Sent: Thursday, February 09, 2012 1:26 AM > To: [email protected] > Subject: Re: help with the INIFile object > > Hi all, Aaron, > Still can't get this to work. I'm getting the following > error: > TestIni.vbs - Microsoft VBScript runtime error > Line 5 Column 1 > Object doesn't support this property or method: > 'INIFile(...).GetINISectionNames' > < 0x800A01B6 > > What's wrong with it now! > Below follows the structure of the test IniFile and > VBScript: > > Structure: > > [Bosses] > boss1=Doug > boss2=Dan > [Support] > name1=Mike > name2=Raul > name3=Aaron > > Begin VBScript: > > Dim MyHotkey > Set MyHotkey = > Keyboard.RegisterHotkey("Control-Shift-Windows-i", > "ReadIni") > Sub ReadIni() > iniString = INIFile(ClientInformation.ScriptPath & > "\test.ini").GetINISectionNames > iniArray = Split(iniString, vbNullChar) > For Each iniName In iniArray > Speak iniName > Next > End Sub > > Can you help? > Warm regards. > Martin Webster > > --- On Wed, 2/8/12, martin webster <[email protected]> > wrote: > > > From: martin webster <[email protected]> > > Subject: Re: help with the INIFile object > > To: [email protected] > > Date: Wednesday, February 8, 2012, 2:15 PM > > Hi Aaron, > > Thanks man, this one did have me puzzled, as I was > unclear > > whether the actual INIFile object could create a file > and > > open it. My understanding of it was I had to create and > open > > the file then read from it, and then close it > afterwards. > > Cheers!!! > > Warm regards. > > Martin Webster. > > > > > > --- On Wed, 2/8/12, Aaron Smith <[email protected]> > > wrote: > > > > > From: Aaron Smith <[email protected]> > > > Subject: Re: help with the INIFile object > > > To: [email protected] > > > Date: Wednesday, February 8, 2012, 1:21 PM > > > Martin, > > > > > > INIFile is a Window-Eyes object. You're trying to > set > > it to > > > a > > > FileSystemObject instead, which isn't going to > work. > > INIFile > > > handles all > > > the reading and writing to INI files. You don't > need > > to > > > involve any > > > additional file system objects. > > > > > > Your routine should look like this: > > > > > > Sub ReadIni() > > > iniString = > > > INIFile(ClientInformation.ScriptPath& > > > "\test.ini").GetINISectionNames() > > > iniArray = Split(iniString, vbNullChar) > > > For Each iniName In iniArray > > > Speak iniName > > > Next > > > End Sub > > > > > > You could shorten that even more by replacing the > > iniString > > > with the call to INIFile, like this: > > > > > > Sub ReadIni() > > > iniArray = > > > Split(INIFile(ClientInformation.ScriptPath& > > > "\test.ini").GetINISectionNames(), vbNullChar) > > > For Each iniName In iniArray > > > Speak iniName > > > Next > > > End Sub > > > > > > Aaron > > > > > > On 2/8/2012 1:22 AM, martin webster wrote: > > > > Hi All, > > > > How do I use the INIFile object. I am trying > to > > get the > > > GetSectionNames example working from the ap > developers > > > manual with no success what so ever. I created > the > > structure > > > in notepad and saved it as a text file with a dot > INI > > > extention called test.ini. > > > > The structure Follows. > > > > > > > > [Bosses] > > > > boss1=Doug > > > > boss2=Dan > > > > [Support] > > > > name1=Mike > > > > name2=Raul > > > > name3=Aaron > > > > > > > > I then wrote the following VBScript to > attempt to > > > retrieve the section names. I keep getting the > error > > object > > > doesn't support this property or wrong number of > > arguments, > > > and when I tried without calling the file system > > object, I > > > got the error no object or some such. > > > > > > > > Begin VBScript > > > > > > > > Dim MyHotkey > > > > Set MyHotkey = > > > > Keyboard.RegisterHotkey("Control-Shift-Windows-i", > > > "ReadIni") > > > > Sub ReadIni() > > > > Dim FSO, ScriptPath > > > > Const ForReading = 1 > > > > ScriptPath = > ClientInformation.ScriptPath& > > > "\test.ini" > > > > Set FSO = > > CreateObject("Scripting.FileSystemObject") > > > > Set INIFile = FSO.OpenTextFile(ScriptPath, > > ForReading) > > > > iniString = INIFile.GetINISectionNames() > > > > iniArray = Split(iniString, vbNullChar) > > > > For Each iniName In iniArray > > > > Speak iniName > > > > Next > > > > End Sub > > > > > > > > Output should be bosses and support. > > > > > > > > Please help, I have no ideas left here apart > from > > just > > > writing a routine in VBScript to do the job of > this > > object. > > > > Warm regards. > > > > Martin Webster. > > > > > > -- > > > Aaron Smith > > > Web Development * App Development * Product > Support > > > Specialist > > > GW Micro, Inc. * 725 Airport North Office Park, > Fort > > Wayne, > > > IN 46825 > > > 260-489-3671 * gwmicro.com > > > > > > To insure that you receive proper support, please > > include > > > all past > > > correspondence (where applicable), and any > relevant > > > information > > > pertinent to your situation when submitting a > problem > > report > > > to the GW > > > Micro Technical Support Team. > > > > > > > > > > > > >
