Sign in to follow this  
Followers 0
neo van matix

Want to create ini's - Problem with Arrays...

7 posts in this topic

Heyho,..

Some Explanation at start...

I write a tool that helps me to install Programs on new workstations at work.

The "Basic" Script is works for many weeks, and now, i wrote an other Script with GUI.

The Idea is the following: I've a list of ~20 Programs (like msoffice, msvisio, and so on..), behind of each entry is a checkbox and a inputbox for priority.

Now i want to click the entries i like to install, and set a priority.

Then, i want to check, which entries are checked. The result of this check (like msoffice,..) will be inserted into an array. Now i read out the priority of the programs in array.

Yet, i will sort the array, and generate an ini-file with div. sections, write sorted desc by the priority into an ini-file.

So, lil example...

MS Office [checkbox] [priority]

MS Visio [checkbox] [priority]

Input:

MS Office -checked- [2]

MS Visio -checked- [1]

Now i want to write the ini:

[MS Visio]

...

[MS Office]

...

u see, the parts with lower priority are behind of parts, with higher priority... u understand?

My Problem...

Func WRITECONFIGS()
    $programme = _ArrayCreate("_msoffice2000", "_msvisio2000", "_msprojekt2000")
    
    For $i = 0 to 2
        $prog2check = "$check"&$programme[$i]
        IF GUICtrlRead($prog2check) = $GUI_CHECKED Then
            msgbox(0, "", $prog2check&" blabla = 1")
        EndIf
    Next
EndFunc

The checkbox names are $check_msoffice2000, $check_msvisio2000, ...

Could it be, that i cannot create variable-names like above shown ?


Attention! English noob ^^

Share this post


Link to post
Share on other sites



Hi,

first of all - why do you want to have a prio? I think there must be a reason why all of the apps should be installed, so it doesn't matter which one is first. :lmao:

To get a solution I'll have to look a bit closer. :">

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

It matter, which will be installed first...

I've finaly 21 programs, which will be installed on new workstations... like winrar, nero, office, visio, acrobat, and so on

The first thing, y i need a exact order to install programs: I must do it in a given order,...

The Second: Some programs have dependencies to others. Example: Before i can install the Acrobat-Updates, i need Acrobat. Or: Before i can install Acrobat, i need to install a postscript-printer.

My code has a length of 1000 rows... and i didnt want to paste all of them into a board... :lmao:

What u need, to look a bit closer? :ph34r:

I think, i gave u enough information, about the script, i'm writing for...

Additional: I havent much more code, that attended to my problem...

i'm sorry for my bad grammatical english :geek:


Attention! English noob ^^

Share this post


Link to post
Share on other sites

Thanks vollyman, but, i think, i've a solution, that appears easier to solve my problem...

Maybe, its a lil bit more Copy&Paste (because i write 21 if-clauses *G*), but i think, its the better way.

Now, my idea works fine for now... but i've another problem...

I want to write these art of ini's:

[Office]

path = xyz

name = xyz

priority = X

Yet, i've 21 sections, each with a prioritylevel.

How should a script appears, which call each path of each section in the order of the priorities ?

Example:

[Office]

path = \\bla\office

name = Office

priority = 3

[Acrobat]

path = \\bla\acrobat

name = Acrobat

priority = 1

[Wirar]

path = \\bla\winrar

name = WinRar

priority = 2

These are the informations in the ini file. But for now: With wich way, i can call Acrobat before Winrar / Office ?


Attention! English noob ^^

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You could try to use a array on a group of GUICtrlCreateCombo controls. One control would be listed becide each app. The range in the control would be 1-21. Your script would look to see what program has the highest priorty, and run that one first. (and so on)

Take a look at this script. It has the layout I'm talking about. I didn't build it using a array, but you should get the idea.

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 269, 273,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Combo_1 = GuiCtrlCreateCombo("", 20, 20, 140, 21)
GUICtrlSetData($Combo_1,"Adobe|MS Office 2003|MS Visio 2003|Winzip 10","")
$Combo_2 = GuiCtrlCreateCombo("", 20, 60, 140, 21)
GUICtrlSetData($Combo_2,"Adobe|MS Office 2003|MS Visio 2003|Winzip 10","")
$Combo_3 = GuiCtrlCreateCombo("", 20, 100, 140, 21)
GUICtrlSetData($Combo_3,"Adobe|MS Office 2003|MS Visio 2003|Winzip 10","")
$Combo_4 = GuiCtrlCreateCombo("", 20, 140, 140, 21)
GUICtrlSetData($Combo_4,"Adobe|MS Office 2003|MS Visio 2003|Winzip 10","")
$Combo_5 = GuiCtrlCreateCombo("", 180, 20, 40, 21)
GUICtrlSetData($Combo_5,"1|2|3|4","")
$Combo_6 = GuiCtrlCreateCombo("", 180, 60, 40, 21)
GUICtrlSetData($Combo_6,"1|2|3|4","")
$Combo_7 = GuiCtrlCreateCombo("", 180, 100, 40, 21)
GUICtrlSetData($Combo_7,"1|2|3|4","")
$Combo_8 = GuiCtrlCreateCombo("", 180, 140, 40, 21)
GUICtrlSetData($Combo_8,"1|2|3|4","")
$Button_9 = GuiCtrlCreateButton("Run", 20, 190, 70, 30)
$Button_10 = GuiCtrlCreateButton("Exit", 120, 190, 70, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

This also allows for any apps to be added without much coding.

Edited by vollyman

Share this post


Link to post
Share on other sites

Ahh,,.. i dont have to sort each entrie in an array in an order...

Its enough to write a lil loop, that searches for the var with the lowest value, then write that part to the ini and delete the var / value from the array...

Harrr!!! I like it.. ^^


Attention! English noob ^^

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