Jump to content
Sign in to follow this  
au3scr

Dynamic ini file

Recommended Posts

au3scr

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

#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 by au3scr

Share this post


Link to post
Share on other sites
au3scr

Do "BUMP" until $answer = "good"


Share this post


Link to post
Share on other sites
spudw2k

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 by spudw2k

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.