Jump to content

Search the Community

Showing results for tags '.ini'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. Hi All, Here is a little GUI I built a while back to learn how to use INI files to store information ( variables ) between opening and closing certain programs. I just recently pulled it back out and cleaned it up and debugged it, if you find any bugs please kill them. The FTP connection part was just so it would have purpose... To cut down on clutter there are no labels, hover mouse over to see what things are. cya, Bill
  2. I'm trying to make a GUI interface that recieves data from my Archangel.ini as default, but can be changed and then saved to the .ini from the GUI program. I'm having trouble creating the save button function that actually writes to the .ini file. Any help would be much appreciated. My ConfigurationGUI.au3 #include <GlobalVars.au3> #include <ArchLib.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $ButtonSave, $ButtonCancel, $msg, $PRI1, $PRI2, $PRI3, $PRI4, $PRI5, $PRI6, $PRI7, $PRI8, $PRI9, $PRI10, $msg2 DecodeIni("Archangel.Ini", False) ;Decodes the .Ini File ;ConsoleWrite($IniProgramGroup & @CR) GUICreate("Archangel Configuration Setup", 500, 400) ;Creates the GUI window GUISetBkColor(0x00E0eeeF) ;Sets Background color $ButtonSave = GUICtrlCreateButton("Save", 200, 350, 45, 30) ;Save button $ButtonCancel = GUICtrlCreateButton("Cancel", 300, 350, 45, 30) ;Cancel Button GUICtrlCreateTab(0, 0, 500, 340) ;Creates the tab GUICtrlCreateTabItem("Speed") ;First tab item GUICtrlCreateLabel("Speed Settings", 10, 25) ;Creates the label for the configuration drop down menu GUICtrlCreateLabel("Show the Speed:", 10, 100) ;Creates the label for the Show the speed config GUICtrlCreateLabel("Speed limit:", 10, 175) ;Creates the label for the Speed limit config GUICtrlCreateCombo("", 275, 100) ;Creates the drop down box GUICtrlSetData(10, "Yes|No", $ShowSpeed) ;Puts the data into the drop down box GUICtrlCreateCombo("", 275, 175) ;Creates the drop down box GUICtrlSetData(11, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30", $SpeedLimit) ;Puts the data into the drop down box GUICtrlCreateTabItem("Serial Settings") ;Tab with serial settings GUICtrlCreateLabel("Serial Settings", 10, 25) ;Creates the label for the serial settings GUICtrlCreateLabel("Communications Port:", 10, 75) ;Creates the label for the commport setting GUICtrlCreateLabel("Baudrate:", 10, 150) ;Creates the label for the Baudrate GUICtrlCreateCombo("", 275, 75) ;Creates the drop down box GUICtrlSetData(16, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50", $NumericPort) ;Puts data into drop down box GUICtrlCreateCombo("", 275, 150) ;Creates drop down box GUICtrlSetData(17, "2400|4800|9600|19200|38400|57600|115200|31250", $BaudRate) ;Puts data into drop down box GUICtrlCreateTabItem("Accesories") ;keyboard, mouse, touchscreen options GUICtrlCreateLabel("Accesories settings", 10, 25) ;Creates label for accesories settings GUICtrlCreateLabel("Block options:", 10, 75) ;Creates the label for the block options GUICtrlCreateCombo("", 275, 75) ;Creates the dorp down box GUICtrlSetData(21, "None|Both|Mouse/Touchscreen|Keyboard", $AlphaBlock[$BlockOption]) ;Puts data into drop down box GUICtrlCreateTabItem("Run Plates") ;Run plate option tab GUICtrlCreateLabel("Ability to run plates", 10, 25) ;creates label for plate running config GUICtrlCreateLabel("Run Plates", 10, 75) ;creates the label for plate running setting GUICtrlCreateCombo("", 275, 75) ;creates drop down box GUICtrlSetData(25, "Yes|No", $RunPlates) ;puts data into drop down box GUICtrlCreateTabItem("Windows Priority") ;windows priority tab GUICtrlCreateLabel("Select Windows Priority", 10, 25) ;creates label for windows priority config GUICtrlCreateLabel("Priority 1:", 10, 40) ;creates label for windows priority 1 GUICtrlCreateLabel("Maximize:", 100, 40) ;creates label for maximize window GUICtrlCreateLabel("Priority 2:", 10, 80) ;creates label for windows priority 2 GUICtrlCreateLabel("Maximize:", 100, 80) ;creates label for maximize window GUICtrlCreateLabel("Priority 3:", 10, 120) ;creates label for windows priority 3 GUICtrlCreateLabel("Maximize:", 100, 120) ;creates label for maximize window GUICtrlCreateLabel("Priority 4:", 10, 160) ;creates label for windows priority 4 GUICtrlCreateLabel("Maximize:", 100, 160) ;creates label for maximize window GUICtrlCreateLabel("Priority 5:", 10, 200) ;creates label for windows priority 5 GUICtrlCreateLabel("Maximize:", 100, 200) ;creates label for maximize window GUICtrlCreateLabel("Priority 6:", 200, 40) ;creates label for windows priority 6 GUICtrlCreateLabel("Maximize:", 300, 40) ;creates label for maximize window GUICtrlCreateLabel("Priority 7:", 200, 80) ;creates label for windows priority 7 GUICtrlCreateLabel("Maximize:", 300, 80) ;creates label for maximize window GUICtrlCreateLabel("Priority 8:", 200, 120) ;creates label for windows priority 8 GUICtrlCreateLabel("Maximize:", 300, 120) ;creates label for maximize window GUICtrlCreateLabel("Priority 9:", 200, 160) ;creates label for windows priority 9 GUICtrlCreateLabel("Maximize:", 300, 160) ;creates label for maximize window GUICtrlCreateLabel("Priority 10:", 200, 200) ;creates label for windows priority 10 GUICtrlCreateLabel("Maximize:", 300, 200) ;creates label for maximize window GUICtrlCreateCombo("", 100, 55) ;Drop down box for maximize selection GUICtrlSetData(48, "Yes|No", $IniMaximize[1]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 100, 95) ;Drop down box for maximize selection GUICtrlSetData(49, "Yes|No", $IniMaximize[2]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 100, 135) ;Drop down box for maximize selection GUICtrlSetData(50, "Yes|No", $IniMaximize[3]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 100, 175) ;Drop down box for maximize selection GUICtrlSetData(51, "Yes|No", $IniMaximize[4]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 100, 215) ;Drop down box for maximize selection GUICtrlSetData(52, "Yes|No", $IniMaximize[5]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 300, 55) ;Drop down box for maximize selection GUICtrlSetData(53, "Yes|No", $IniMaximize[6]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 300, 95) ;Drop down box for maximize selection GUICtrlSetData(54, "Yes|No", $IniMaximize[7]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 300, 135) ;Drop down box for maximize selection GUICtrlSetData(55, "Yes|No", $IniMaximize[8]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 300, 175) ;Drop down box for maximize selection GUICtrlSetData(56, "Yes|No", $IniMaximize[9]) ;puts data into drop down box for maximize selection GUICtrlCreateCombo("", 300, 215) ;Drop down box for maximize selection GUICtrlSetData(57, "Yes|No", $IniMaximize[10]) ;puts data into drop down box for maximize selection $PRT1 = GUICtrlCreateCombo("", 10, 55) ;Drop down box for priority input GUICtrlSetData(58, "Spillman Mobile|None|Example1|Example2", $IniPriority[1]) ;puts data into drop down box for priority input/selection $PRT2 = GUICtrlCreateCombo("", 10, 95) ;Drop down box for priority input GUICtrlSetData(59, "Spillman Mobile|None|Example1|Example2", $IniPriority[2]) ;puts data into drop down box for priority input/selection $PRT3 = GUICtrlCreateCombo("", 10, 135) ;Drop down box for priority input GUICtrlSetData(60, "Spillman Mobile|None|Example1|Example2", $IniPriority[3]) ;puts data into drop down box for priority input/selection $PRT4 = GUICtrlCreateCombo("", 10, 175) ;Drop down box for priority input GUICtrlSetData(61, "Spillman Mobile|None|Example1|Example2", $IniPriority[4]) ;puts data into drop down box for priority input/selection $PRT5 = GUICtrlCreateCombo("", 10, 215) ;Drop down box for priority input GUICtrlSetData(62, "Spillman Mobile|None|Example1|Example2", $IniPriority[5]) ;puts data into drop down box for priority input/selection $PRT6 = GUICtrlCreateCombo("", 200, 55) ;Drop down box for priority input GUICtrlSetData(63, "Spillman Mobile|None|Example1|Example2", $IniPriority[6]) ;puts data into drop down box for priority input/selection $PRT7 = GUICtrlCreateCombo("", 200, 95) ;Drop down box for priority input GUICtrlSetData(64, "Spillman Mobile|None|Example1|Example2", $IniPriority[7]) ;puts data into drop down box for priority input/selection $PRT8 = GUICtrlCreateCombo("", 200, 135) ;Drop down box for priority input GUICtrlSetData(65, "Spillman Mobile|None|Example1|Example2", $IniPriority[8]) ;puts data into drop down box for priority input/selection $PRT9 = GUICtrlCreateCombo("", 200, 175) ;Drop down box for priority input GUICtrlSetData(66, "Spillman Mobile|None|Example1|Example2", $IniPriority[9]) ;puts data into drop down box for priority input/selection $PRT10 = GUICtrlCreateCombo("", 200, 215) ;Drop down box for priority input GUICtrlSetData(67, "Spillman Mobile|None|Example1|Example2", $IniPriority[10]) ;puts data into drop down box for priority input/selection GUISetState(@SW_SHOW) ;Shows the GUI window ;MsgBox(2, "Checker", $PRT1) ;Checks the ControlID ;MsgBox(2, "error detection", $DataSelect) ;error detection(combo 4) ;Makes cancel button and the close button(top right x) close the program While -1 $msg = GUIGetMsg() Select Case $msg = $ButtonCancel Or $msg = $GUI_EVENT_CLOSE Case "Show the speed" If "Yes" Or "No" Then FileWriteLine("Archangel.ini", 10) EndIf ExitLoop EndSelect WEnd My GlobalVars.au3 ; Path Variables Global $IniName = "Archangel.ini" Global $ProgramDir = @ProgramFilesDir & "\Archangel" ;From ini Global $IniProgramGroup = "" Global $IniVersion = "" Global $ShowSpeed = "No" Global $CommPort = "" Global $NumericPort Global $BaudRate = 9600 Global $SpeedLimit = 15 Global $ClearOnTop = "No" Global $IniFiles, $IniFileName[10] Global $IniPriorities, $IniPriority[11], $IniMaximize[11] Global $RunPlates = "No" Global $BlockOption = 1 Global $BlockMouse = True Global $AlphaBlock[4] $AlphaBlock[0] = "None" $AlphaBlock[1] = "Both" $AlphaBlock[2] = "Mouse/TouchScreen" $AlphaBlock[3] = "Keyboard" ; Log Variables Global $LogHandle = -1 Global $LogError = False Global $LogDetail = "No" Global $LogFile = "" Global $Sequence = "Init" ; Log / Error / Debugs Global $Debug = False Global $IsErrorFatal = "No", $ErrorTitle = "", $ErrorMessage = "" ; Miscellaneous Const $SpeedCursor = "Current speed is " Global $LenSpeedCursor = StringLen($SpeedCursor) Global $SFResult[2] $SFResult[0] = "failed" $SFResult[1] = "successful" ; Speed Variables Global $LastSpeed = 0 ; Communications to Herbie Global $Kernel32Handle = -1 Global $SerialPortHandle = -1 Global $DCB_Struct = "" Global $CommTimeout = "" Global $CommTimeout_Struct = "" Global $CommState = "" Global $CommState_Struct = "" Global $HerbieError = False Global $ReceivedFromHerbie = "" Global $SpeedValidation = "410D" Global $CurrentSpeed = 0 ; SDX Dongle Global $SDXHandle = -1 Global $tSDXHID = DllStructCreate("DWORD") My Archlib.au3 Func DecodeIni($FullIniPath, $LogIt) Local $NotFound = "Not Found", $Result = 0, $Index = 0 $ErrorTitle = "Error Reading Initialization File" $ErrorMessage = $FullIniPath $IsErrorFatal = True $IniProgramGroup = IniRead($FullIniPath, "Version", "ProgramGroup", $NotFound) If $IniProgramGroup = $NotFound Then MyError() EndIf $IniVersion = IniRead($FullIniPath, "Version", "VersionNumber", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $NumericPort = IniRead($FullIniPath, "Communication", "Port", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $CommPort = "COM" & $NumericPort If ($NumericPort > 9) Then $CommPort = "\\.\" & $CommPort EndIf $BaudRate = IniRead($FullIniPath, "Communication", "Baudrate", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $SpeedLimit = IniRead($FullIniPath, "ProgramOptions", "SpeedLimit", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $ShowSpeed = IniRead($FullIniPath, "ProgramOptions", "ShowSpeed", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $ClearOnTop = IniRead($FullIniPath, "ProgramOptions", "ClearOnTop", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $RunPlates = IniRead($FullIniPath, "ProgramOptions", "RunPlates", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $Result = IniRead($FullIniPath, "ProgramOptions", "Block", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $BlockMouse = True Select Case $Result = "None" $BlockOption = 0 $BlockMouse = False Case $Result = "Both" $BlockOption = 1 Case $Result = "Mouse" $BlockOption = 2 Case $Result = "Keyboard" $BlockOption = 3 $BlockMouse = False Case Else $BlockOption = 0 EndSelect $LogDetail = IniRead($FullIniPath, "LogOptions", "LogDetail", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $LogFile = IniRead($FullIniPath, "LogOptions", "LogFile", $NotFound) If $IniVersion = $NotFound Then _MyError() EndIf $Index = 1 While 1 $IniFileName[$Index] = IniRead($FullIniPath, "Files", "File" & $Index, $NotFound) If $IniFileName[$Index] = $NotFound Then ExitLoop EndIf $Index += 1 WEnd $IniFiles = $Index - 1 $Index = 1 While 1 $IniPriority[$Index] = IniRead($FullIniPath, "WindowPriorties", "WindowPriority" & $Index, $NotFound) If $IniPriority[$Index] = $NotFound Then ExitLoop EndIf $Index += 1 WEnd $IniPriorities = $Index - 1 $Index = 1 While 1 $IniMaximize[$Index] = IniRead($FullIniPath, "WindowPriorties", "WindowMaximize" & $Index, $NotFound) If $IniMaximize[$Index] = $NotFound Then ExitLoop EndIf $Index += 1 WEnd If $LogIt = False Then Return EndIf WriteLog(" Ini Path: " & $FullIniPath) WriteLog(" Program: " & $IniProgramGroup) WriteLog(" Version: " & $IniVersion) WriteLog(" Port: " & $CommPort) WriteLog(" Baudrate: " & $BaudRate) WriteLog("SpeedLimit: " & $SpeedLimit) WriteLog(" ShowSpeed: " & $ShowSpeed) WriteLog("ClearOnTop: " & $ClearOnTop) WriteLog(" RunPlates: " & $RunPlates) WriteLog(" Block: " & $AlphaBlock[$BlockOption]) WriteLog(" LogDetail: " & $LogDetail) WriteLog(" LogFile: " & $LogFile) WriteLog("Priorities: " & $IniPriorities) If $IniPriorities >= 1 Then For $Index = 1 To $IniPriorities WriteLog("Priority " & $Index & ": " & $IniPriority[$Index]) WriteLog("Maximize " & $Index & ": " & $IniMaximize[$Index]) Next EndIf EndFunc Func MyCopyProgressOn($Title, $SFileName, $DFileName, $FileSize, $Operation) Local $DisplayName = "" $DisplayName = "Source: " & StringLower($SFileName) ProgressOn($Title, $DisplayName, "0 of " & _StringAddThousandsSepEx($FileSize) & " bytes " & $Operation & " (0%)") EndFunc Func MyCopyProgressSet($ProgressBytes, $FileSize, $Operation) Local $Percent = 0 $Percent = Round((($ProgressBytes / $FileSize) * 100), 0) If $Percent >= 100 Then $Percent = 99 $ProgressBytes = $FileSize - 1 EndIf ProgressSet($Percent, _StringAddThousandsSepEx($ProgressBytes) & " of " & _StringAddThousandsSepEx($FileSize) & " bytes " & $Operation & " (" & $Percent & "%)") Sleep(1) EndFunc Func MyCopyProgressOff() ProgressSet(100 , "Done") Sleep(500) ProgressOff() EndFunc Func MyError() Beep() MsgBox(0, $ErrorTitle, $ErrorMessage) If $IsErrorFatal = True Then Exit EndIf EndFunc Func MyProgressCopy($FullSRC, $FullDST) Dim $OptEnv = "", $OptVar = "", $size = 0, $count = 0, $timer = 0, $progress = 0, $in = 0, $out = 0 Local $Bin, $Chunk, $ProgTitle $ErrorTitle = "Error Copying File" $ErrorMessage = $FullSRC $IsErrorFatal = True ; Turn off expanded environment or variables, can cause problems for binary read $OptEnv = Opt("ExpandEnvStrings", 0) $OptVar = Opt("ExpandVarStrings", 0) ; Get size of file to determine remaining $Size = FileGetSize($FullSRC) If $Size = 0 Then MyError() EndIf ; Set up initial variables $Count = 0 ;keep count of bytes copied $Chunk = 102400 ;amount of data to copy at a time (bytes) (10kB) $Progtitle = "Copying File ..." ;title of progress bar window $Timer = TimerInit() ;initialize timer to keep track of update frequency ; Show progress bar MyCopyProgressOn("Copying File ...", $FullSRC, $FullDST, $size, "copied") ; Open input and output files (exit if error) $In = FileOpen($FullSRC, 4) If @error <> 0 Then MyError() EndIf $Out = FileOpen($FullDST, 2) If @error = -1 Then FileClose($In) MyError() EndIf ; Start reading input $Bin = FileRead($In, $Chunk) While @error = 0 ; Write chunk of data, keep trying for up to 10 seconds if failed Do FileWrite($Out, $Bin) Until (@error = 0) Or (TimerDiff($timer) > 10000) If @error <> 0 Then FileClose($In) FileClose($Out) MyError() EndIf ; Update copy counter $Count = $Count + $Chunk ; Update progress as specified MyCopyProgressSet($Count, $Size, "copied") $timer = TimerInit() ; get chunk of data $bin = FileRead($In, $Chunk) WEnd FileClose($In) FileClose($Out) MyCopyProgressOff() ; Reset expanded environment or variables Opt("ExpandEnvStrings", $OptEnv) Opt("ExpandVarStrings", $OptVar) EndFunc Func WaitWithProgress($Caption, $Seconds) ProgressOn($Caption & ". Please wait ...", "") Local $Loops = 0, $Delay = 0, $Percent = 0 $Loops = Round(($Seconds * 2.0),0) $Delay = Round ((($Seconds / $Loops) * 1000), 0) For $I = 1 to $Loops $Percent = (($I / $Loops) * 100) ProgressSet($Percent) Sleep($Delay) Next ProgressOff() EndFunc Func TurnOffOnTop() Local $Index = 0, $Result = 0, $WindowList, $iExStyles = 0, $Candidate = 0 $WindowList = WinList() For $Index = 1 to $WindowList[0][0] $iExStyles = _WinAPI_GetWindowLong($WindowList[$Index][1],$GWL_EXSTYLE) $Candidate = ($WindowList[$Index][0] <> "") And (IsWindowVisible($WindowList[$Index][1])) $Candidate = $Candidate And (BitAND($iExStyles,$WS_EX_TOPMOST)) $Candidate = $Candidate And (StringLeft($WindowList[$Index][0], $LenSpeedCursor) <> $SpeedCursor) If $Candidate = 1 Then $Result = WinSetOnTop($WindowList[$Index][1], "", 0) WriteLog($WindowList[$Index][0] & " topmost set was: " & $SFResult[$Result]) EndIf Next EndFunc Func IsWindowVisible($WindowHandle) If BitAnd( WinGetState($WindowHandle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc My Archangel.ini file [Version] ProgramGroup=Archangel VersionNumber=1.00 [Communication] Port=35 Baudrate=9600 [ProgramOptions] SpeedLimit=25 ShowSpeed=No ClearOnTop=Yes RunPlates=No Block=None [LogOptions] LogDetail=No LogFile=Archangel.log [Files] File1=Archangel.exe File2=sdx.dll File3=Green.ico File4=Red.ico [WindowPriorties] WindowPriority1=Spillman Mobile - WindowMaximize1=Yes
×
×
  • Create New...