Sign in to follow this  
Followers 0
DopeHN

Need Help .ini

3 posts in this topic

ok so my script is coming together but i cant seem to get my .ini to work here is my script... i am trying to make it grab all of the inputted info and then have it make an ini file when they add the "customer" then they would be able to go to the other tab and view the stuff that they inputted any ideas here is what i have '

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Airsoft Form Creator", 421, 208, 375, 154)
GUICtrlCreateTab(4, 4, 600, 600)
GUICtrlCreateTabItem("Create Customer Form")
$Name = GUICtrlCreateInput("Name", 28, 38, 173, 21)
$Email = GUICtrlCreateInput("Email", 28, 66, 173, 21)
$Phone = GUICtrlCreateInput("Phone Number", 28, 94, 173, 21)
$GunType = GUICtrlCreateInput("Gun Type", 213, 38, 185, 21)
$GunProblem = GUICtrlCreateInput("Gun Problem", 213, 67, 185, 21)
$AddCustomer = GUICtrlCreateButton("Add To Customer List", 212, 94, 185, 21)
$Label1 = GUICtrlCreateLabel("Part's List", 166, 120, 60, 17)
$Combo1 = GUICtrlCreateCombo("", 24, 141, 229, 50, BitOR ($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Polymer spring guide V2|Polymer spring guide V3|Polymer ball bearing  spring guide V2|Polymer ball bearing spring guide V3|Metal ball bearing spring guide V2|Metal ball bearing spring guide V3|M90 Spring SHS|M100 Spring SHS|M110 Spring SHS|M120 Spring SHS|M130 Spring SHS|M140 Spring SHS|Replacement Piston SHS|3 Steel Teeth Piston SHS|7 Steel Teeth Piston SHS|14 Steel Teeth Piston SHS|15 Steel Teeth Piston SHS|Replacement Piston Head|Polymer Ball Bearing Piston Head|Alluminum Ball Bearing Piston Head|Replacement Cylinder|Type A Cylinder|Type B Cylinder|Type C Cylinder|Type D Cylinder|Replacement Cylinder head V2|Replacement Cylinder head V3|Alluminum Cylinder head V2|Alluminum Cylinder head V3|Replacement Nozzle|Airseal Nozzle|Alluminum Airseal Nozzle|Replacement Tappet Plate|6mm Bushings SHS|")
$Combo1 = GUICtrlCreateCombo("", 24, 163, 229, 50, BitOR ($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Airseal Nozzle|Alluminum Airseal Nozzle|Replacement Tappet Plate|6mm Bushings SHS|7mm Bushings SHS|8mm Bushings SHS|9mm Bushings SHS|6mm Bearings SHS|7mm Bearings SHS|8mm Bearings SHS|9mm Bearings SHS|Replacement Gearset|CNC 18:1 Upgrade Gearset|CNC High Speed Upgrade Gearset|CNC High Torque Upgrade Gearset|CNC Bevel Gear Replacement|CNC Spur Gear Replacement|CNC Sector Gear Replacement|Anti Reversal SHS|Upgrade Anti Reversal|Silicone Wiring|Motor Connectors|Wire Harness|Replacement Motor Short|Replacement Motor Medium|Replacement Motor Long|High Speed Motor Short|High Speed Motor Medium|High Speed Motor Long|" )
$Button1 = GUICtrlCreateButton("Add Part", 258, 148, 75, 17)
$Combo1 = GUICtrlCreateCombo("", 24, 185, 229, 50, BitOR ($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "High Torque Motor Short|High Torque Motor Medium|High Torque Motor Long|Replacement Heat Treaeted Pinion Gear|Replacement Gearbox Screws|Gearbox Spring Set V2|Gearbox Spring Set V3|")
GUICtrlCreateTabItem("Customer Form's")
$list = GUICtrlCreateListView("", 16, 28, 400, 175)
$col1 = _GUICtrlListView_AddColumn($list, "Name", 50)
$col2 = _GUICtrlListView_AddColumn($list, "Email", 50)
$col3 = _GUICtrlListView_AddColumn($list, "Phone #", 58)
$col4 = _GUICtrlListView_AddColumn($list, "GunType", 65)
$col5 = _GUICtrlListView_AddColumn($list, "GunProblem", 90)
$col6 = _GUICtrlListView_AddColumn($list, "Parts", 50)
$Customers = IniReadSectionNames("Customer.ini")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $AddCustomer
   IniWrite("Customer.ini", GUICtrlRead($Name), GUICtrlRead($Email), GUICtrlRead($Phone), GUICtrlRead($GunType), GUICtrlRead($GunProblem), GUICtrlRead($Combo1))
  

EndSwitch
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First thing, look at the help file for IniWrite, the format for the function is IniWrite ( "filename", "section", "key", "value" ), your IniWrite line won't pass the AU3Check program because you have too many arguments in there.

Second thing, decide how you want the INI file laid out. If you want the customer name to be the section name, then you'd need to rewrite the IniWrite to take that into consideration and you're going to need to use separate IniWrites for every line in the section. Look at some of the examples in the help file and here in the forum.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

First thing, look at the help file for IniWrite, the format for the function is IniWrite ( "filename", "section", "key", "value" ), your IniWrite line won't pass the AU3Check program because you have too many arguments in there.

Second thing, decide how you want the INI file laid out. If you want the customer name to be the section name, then you'd need to rewrite the IniWrite to take that into consideration and you're going to need to use separate IniWrites for every line in the section. Look at some of the examples in the help file and here in the forum.

thanks for your help i am very new to autoit so even the help files dont help me that much so yaa sorry if these sound like very pointless questions its just hard to understand what some of the stuff means cause im so new to the scripting game

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  
Followers 0