Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

array from .ini file issues

$
0
0
trying to get a very basic gui that has 2 simple buttons, one is a help button that basically describes how to add a key to the array in the ini file, the other is a button that generates text from the array to a msgbox in random order. for some reason,  if anyone knows what I did to screw this up, or what I left out, I would appreciate it, been looking at help topics for awile now and they are all getting blurry. lol

my ini file looks like this

[ autoit ]      
[Topics] Key = Random 1 Key = Random 2 key = Random 3 key = Random 4 key = Random 5

here is my code

[ autoit ]         
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("topic generator", 398, 230, 192, 124) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\bg.jpg", 0, 0, 396, 228) $Safety = GUICtrlCreateButton("Click me!", 120, 88, 155, 57) GUICtrlSetBkColor(-1, 0xFFFF00) $Help = GUICtrlCreateButton("click me for Help", 152, 192, 91, 25) GUISetState(@SW_SHOW) Local $var = IniRead(@ScriptDir & "\Safety.ini", "Topics", "key", "NotFound") $var = IniReadSection("Safety.ini", "Topics") #EndRegion ### END Koda GUI section ### $str = "" For $i = 1 To $var[0][0] $str &= $var[$i][1] & "|" Next $str = StringTrimRight($str, 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Safety Safety() Case $Help Help() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Safety() MsgBox(4096, "Result", $var) GUICtrlSetData(-1, $str) EndFunc Func Help() MsgBox(4096, "Help", "Simply press the safety button for a random daily safety topic. The Safety topics are loaded from the Safety.ini that was distributed with this program. You can add more safety topics by editing a few simple lines of code while also adding your safety topic to the array found in the Safety.ini file! Talk to me (Joe Learn) if you have any further qeustions.") EndFunc

thank you in advance

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>