Jump to content
flyfamilyguy

Autoit3 and .ini files?

Recommended Posts

flyfamilyguy

Hello everyone.

Been browsing around a little bit through the forum, my brain spinning with ideas that I'm planning out as im typing here, so if anyone thinks that I have not spent enough time searching

for the answer in an archive somewhere, blame it on my excitement at getting back to my desktop before I forget wth I was going to do! :)

I ve been taking my time with an application that Im writing, scrapping things as new ideas come. Cant explain why really, but ive always liked the idea of incorporating both batch and Autoit in my programs so that's been the case with everything ive done to date. Currently I'm trying to focus on finishing through to a final result,  I guess you could call it a 'wysiwyg' html webpage and css creation utility. Its been run a hundred times or more and scrapped only to rewrite a few lines here and there due to my overactive brain matter. most of the code was done in batch . Interactive commandline, echoing tags and strings into files blah blah blah. The autoit portion comes as the Nice Gui interface with all the options for a webpage or css then once chosen the gui scribbles a couple of lines into a file where the batch code comes in, reads the file then executes predefined directives based on what was specified.

My question I swear!

I would really like to try out Autoit for the entire app from gathering the user specs to creation along with ini and maybe inf files. Is it possible for Autoit to read and execute from an .ini?

Thanks]

Sorry folks. Just scrolled down after posting and WAM, there by Golly were a bunch of 'related' topics on ini's!  but Ill still take any new input/ideas thanks

Edited by flyfamilyguy
update

Share this post


Link to post
Share on other sites
water

In short:
Sure, check the Ini* functions in the help file.

You will get more helpful advise when you have a question based on real code :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
flyfamilyguy

In short:
Sure, check the Ini* functions in the help file.

You will get more helpful advise when you have a question based on real code :)

​Hi First I'm real sorry that it has taken so long to respond. Unexpected and unwanted circumstances popped up so was far from pc and me time. I'm not sure I Understand what you mean by "..based on real code" my friend. The code is very real indeed and works quite well. It created the pages found here There is still much work to be done with it but all in all it's coming along. I was at the time searching for ways to kind of veer away from batch and especially  begin using configuration files such as ini. to make the writing a little easier and less of it. Also just about every character/tag in html is recognized by comspec as something completely different resulting early on in a lot of errors and incomplete files being produced. I finally managed to get around this (Windows cmd.exe tolerates a lot of abuse. not real strict with the language to say the least) so...

But anyway, Thank you for the reply and yes I found the help section on ini. At the time for some reason (think it was something a friend said) I was thinking there was no 'ini and Autoit' so I didn't even bother to check and instead came straight here.

Share this post


Link to post
Share on other sites
JLogan3o13

Water was trying to point out that, without posting your code, you make it a little difficult on those trying to help. We have to first guess at what you're doing and then try to troubleshoot. Your first post in any topic should always include code - if not the whole code then at least a short reproducer that demonstrates the problem.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
water

Couldn't have worded it better :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

  • Similar Content

    • Pike
      By Pike
      Hello Everyone,
      New Guy here. This is a two-part question, hopefully easy enough though. I know it's ugly coding, this is because I have only a couple hours worth of coding experience and could really use some help.
      1) When I single click the button I want one action (like playing a sound clip) and when I double click the button I want a different action (such as opening dialogue box to ask for soundclip directory address). At the bottom of the script I made a comment which one I would like single click versus double click.
      2) I can not get the FileOpenDialogue to save the file address to the config.ini file at the 'One' position on the .ini.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> #include <Sound.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $OneID _Main() Func _Main() GUICreate("Form1", 156, 86, 281, 276) $OneID = GUICtrlCreateButton("Button", 15, 17, 122, 37) GUICtrlSetOnEvent($OneID, "OnOne") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() While 1 While 1 Sleep(1000) WEnd WEnd EndFunc ;---------------Functions------------- While 1 Sleep(100) WEnd Func OnOne() ; ******************Single Click for this action**************** $OneID = IniRead("config.ini", "Config", "One", $OneID) If $OneID = True Then SoundPlay($OneID, @HotKeyPressed) Else ; *******Double Click for this action*****And Help Saving File Address to config.ini 'One'*********** $OneID = FileOpenDialog("Select file", @WorkingDir, "All (*.*)") IniWrite("config.ini", "Config", "One", $OneID) $OneID = InputBox("Enter Information", "Short Name for File?", "") IniWrite("config.ini", "Config", "NameOne", $OneID) EndIf EndFunc Any help would be greatly appreciated, and if you need anymore clarity as to what exactly I'm trying to do, please do not hesitate to ask. Thanks so much!
      Pike
    • kartune
      By kartune
      Hi, i would like to know if there is a possible way to use subsections for ini files?
      For example, my ini file would look something like this:
       
      Clientname.ini
      [Info]
      Country=USA
      Type=Distributor
       
      [Costs]
      [[JAN]] <----- subsection
      cost1=----
      cost2=----
      [[FEB]]
      cost1=----
      cost2=----
       
      [Sales]
      [[JAN]] <----- subsection
      sale1=----
      sale2=----
      [[FEB]]
      sale1=----
      sale2=----
       
      [Profits]
      [[JAN]] <----- subsection
      prof1=----
      prof2=----
      [[FEB]]
      prof1=----
      prof2=----
       
      The sales would be inputed everyday by the script, and then whenever viewed, i would be using an array to view every sale/cost/profit under the subsection
       
       
      Thanks for your time!
    • ercicttech
      By ercicttech
      Hello, all..

      My AutoIT is pretty terrible - but I get by with trawling here
      I came across an issue where i had to parse a large key in a large ini file, and found that I was victim of inireadsection's limit of "Only the first 32767 chars are read for legacy reasons."
       
      I've attempted to put together some terrible code that parses an ini section.
      It's absolutely nowhere near good, but I figured I'd put it here so that folk who know what they're doing can laugh at improve it.
      $Ini = @ScriptDir & "\bigini.ini" Dim $IniArray[0][2] $KeyName = "Person" $R = FileOpen($Ini, 0) $IniStr = FileRead($R) FileClose($R) $Start = StringInStr($iniStr, "[" & $KeyName & "]") If $Start = 0 then Msgbox(16, "Error", "String not found") Exit EndIf $Stop = StringInStr($IniStr, @CRLF & "[", 0, 1, ($Start + 1)) If $Stop = 0 then $Stop = StringLen($IniStr) EndIf $String = StringMid($IniStr, $Start, ($Stop - $Start)) $Split = StringSplit($String, @CRLF, 1) $KeyCount = 0 Dim $IniArray[65535][2] For $Loop = 1 to $Split[0] $Add = "Y" $Str = $Split[$Loop] $EQBreak = StringInStr($Str, "=") Select Case StringMid($Str, 1, 1) = ";" $Add = "N" Case $EQBreak = 0 $Add = "N" Case Else $Add = "Y" EndSelect If $Add = "Y" then $KeyCount = $KeyCount + 1 $Key = StringMid($Str, 1, ($EQBreak - 1)) $Val = StringMid($Str, ($EQBreak + 1)) $IniArray[$KeyCount][0] = $Key $IniArray[$KeyCount][1] = $Val EndIf Next Redim $IniArray[$KeyCount +1][2] ; Add the number of hits to 00 to match inireadsection $IniArray[0][0] = $KeyCount _ArrayDisplay($IniArray) ; Do stuff with the Array like you would inireadsection  
    • RC86
      By RC86
      Afternoon, I could very well be doing this wrong so feel free to totally advise otherwise - I'm wanting to use a GUI to first display a key from within an INI file, then secondly change the INI file by using a FileSelectFolder command but then I want to see the GUI change to reflect the change I've just made.
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Input1 = GUICtrlCreateInput(Iniread(@WorkingDir & "\test.ini","Path","FilePath",""), 64, 80, 121, 21) $Button1 = GUICtrlCreateButton("Change", 200, 80, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $selectedFolder = FileSelectFolder("Select Log Path Directory",@WorkingDir,0) If NOT $selectedFolder = "" Then $newLogPath = IniWrite(@WorkingDir & "\test.ini","Path","FilePath",$selectedFolder) EndIf EndSwitch WEnd So 2 part question really: (1) Should I be using GUICtrlCreateInput to display my INI read from within the GUI? (2) How can I refresh the GUI to update that to read the new information I've just written to the GUI?
      Thanks!

    • LWC
      By LWC
      I've made a program that relies on IniReadSectionNames. It reads (~3K) Autorun.inf files in the working folder and creates a GUI based on their contents.
      I made sure to revert to a default GUI upon @error.
      But someone (with Windows XP SP3 32-bit) reported to me he always gets the default menu.
      I sent him a FileRead command instead and it works! So seemingly there's no access problem to AutoRun.inf.
      In the following demo code, I always hit success, but he always ends up with semi-success:
      Local $hIniLocation = "Autorun.inf" Local $aSections = IniReadSectionNames($hIniLocation) If @error Then $aSections = FileRead($hIniLocation) if @error then msgbox(48, "Double error", "Alternative access failed too due to:" & @crlf & @error & @crlf & @extended) else msgbox(0, "Semi-success", "IniReadSectionNames failed, but alternativaly this file contains:" & @crlf & @crlf & $aSections) endif else msgbox(0, "Success", "IniReadSectionNames worked!") endif Why is that? Is there something further to check with him?
      Autorun.inf
×