au3scr Posted May 15, 2008 Posted May 15, 2008 (edited) how to write dynamic list from ini file? I have made This string dynamic already "Number programs selected for instalation:X" X is dynamic number. how to return program names dynamically? I need make list look like Program1 & @crlf Program2 & @ crlf..and so on. programx is that i want make change dynamically.It already returns . Edit: At the moment $ProgramName shows only 1 thing in Edit control. , but how i can make it show in edit all items that are listed in "install" section? I want make program that takes its list of programs to install from ini file. sorry for bad english, i hope than i am understandable Number programs selected for instalation:2 Firefox Starting instalation but how to make it say Number programs selected for instalation:2 Firefox Thunderbird Starting instalation??? here is my script expandcollapse popup#include <GUIConstants.au3> #include <misc.au3> #include <GUIEdit.au3> #include <string.au3> ;~ $var = IniReadSection("install.ini","install") ;~ For $i = 1 To $var[0][0] ;~ MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) ;~ Next global $currentprogram = "" Global $ishide = IniRead(@ScriptDir&"\install.ini","general","HideGUI","def") $Form1 = GUICreate("Apt-get", 640, 480, 201, 116, BitOr($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX)) $MenuItem1 = GUICtrlCreateMenu("General") $MenuItem11 = GUICtrlCreateMenuItem("Copy text", $MenuItem1) $MenuItem12 = GUICtrlCreateMenuItem("Save text", $MenuItem1) $MenuItem13 = GUICtrlCreateMenuItem("Fullscreen", $MenuItem1) $MenuItem14 = GUICtrlCreateMenuItem("Hide", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("Help") $MenuItem21 = GUICtrlCreateMenuItem("About", $MenuItem2) $MenuItem22 = GUICtrlCreateMenuItem("Install.ini Commands", $MenuItem2) Global $output = GUICtrlCreateedit ("",3,0,638,460,$ES_NOHIDESEL) WinActivate ("Apt-get") Send("dfsd") GUICtrlSetBkColor(-1,0x000000) GUICtrlSetColor(-1,0xC0C0C0) GUICtrlSetFont(-1, 10, 500, 0,"terminal") GUICtrlSetData ($output,"Welcome to installer, made by Rain"&@crlf&'To see avaible commands click on help menu and then click on "Install.ini Commands"') $admin = IsAdmin () If $admin = 0 Then $oldoutput = GUICtrlRead($output) GUICtrlSetData($output,$oldoutput&@CRLF&"Sorry, you DO NOT have permission to install any programm, please exit now") EndIf _getlist () GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem11 $textcopy = GUICtrlRead ($output) ClipPut ($textcopy) Case $MenuItem13 WinMove("Apt-get","",0,0,@DesktopWidth,@DesktopHeight) case $MenuItem21 msgbox (48,"Help","No help avaible yet") case $MenuItem21 msgbox (48,"Commands","No any commands yet") case $MenuItem14 $ishide = 1 GUISetState(@SW_HIDE) EndSwitch WEnd Func _getlist () $ProgramsToInstall = 0 $var = IniReadSection("install.ini","install") For $i = 1 To $var[0][0] ;~ MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) $ProgramName = $var[$i][1] $ProgramsToInstall = $ProgramsToInstall +1 Next $ProgramName = "Firefox" $oldoutput = GUICtrlRead($output) GUICtrlSetData($output,$oldoutput&@CRLF&" "&@CRLF&"Number programs selected for instalation:"&$ProgramsToInstall) $oldoutput = GUICtrlRead($output) GUICtrlSetData($output,$oldoutput&@CRLF&" "&@CRLF&$ProgramName) $oldoutput = GUICtrlRead($output) GUICtrlSetData($output,$oldoutput&@CRLF&" "&@CRLF&"Starting instalation") ;~ _firefoxask () EndFunc and here is ini [general] HideGUI=0 [install] install=firefox install=thunderbird Edited May 20, 2008 by au3scr
spudw2k Posted May 20, 2008 Posted May 20, 2008 (edited) How's this? Func _getlist () $oldoutput = "" $ProgramsToInstall = 0 $var = IniReadSection("install.ini","install") GUICtrlSetData($output,$oldoutput&@CRLF&" "&@CRLF&"Number programs selected for instalation:"&$var[0][0]) $oldoutput = GUICtrlRead($output) For $i = 1 To $var[0][0] $ProgramName = $var[$i][1] GUICtrlSetData($output,$oldoutput&@CRLF&" "&$ProgramName) $oldoutput = GUICtrlRead($output) Next $oldoutput = GUICtrlRead($output) GUICtrlSetData($output,$oldoutput&@CRLF&" "&@CRLF&"Starting instalation") EndFunc Edited May 20, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now