Jump to content
Sign in to follow this  
alienkillaz

is this possible?

Recommended Posts

alienkillaz

Dim $avArray[10]

$avArray[0] = "JPM"

$avArray[1] = "Holger"

$avArray[2] = "Jon"

$avArray[3] = "Larry"

$avArray[4] = "Jeremy"

$avArray[5] = "Valik"

$avArray[6] = "Cyberslug"

$avArray[7] = "Nutster"

$avArray[8] = "JdeB"

$avArray[9] = "Tylo"

msgbox(1,"",$avarray[2]-[4])

obviosly this specific method doesnt work ir i wouldnt be posting, but is thier a way to do something similiar

Share this post


Link to post
Share on other sites
Nahuel

:)

Global $Hey=""
Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

For $i=2 to 4
    $Hey=$Hey&" "&$avArray[$i]
Next
MsgBox(0,"",$Hey)

Share this post


Link to post
Share on other sites
weaponx

This is a little cleaner looking

$Hey &= " " & $avArray[$i]

This works too

#include <array.au3>

MsgBox(0,"",_ArrayToString($avArray, " ", 2, 4))

Share this post


Link to post
Share on other sites
alienkillaz

This is a little cleaner looking

$Hey &= " " & $avArray[$i]

This works too

#include <array.au3>

MsgBox(0,"",_ArrayToString($avArray, " ", 2, 4))

these are good answers but im having trouble applying it to my script.

more specifically what im trying to do is reduce the # of (case $msg =treeitemview)

let me try and explain, lets say the number of GUICtrlCreateTreeViewItem's to be created could range from 1-100 every time the script is started. and i want to have a different case=$msg for each of them i would have to write 100x

case = GUICtrlCreateTreeViewItem ($varr[$var],$topitem)

command()

command1()

what i want will look something like this

case $msg = GUICtrlCreateTreeViewItem ($varr[1]-[4],$topitem)

also i need to be able to tell from the above case which $varr was called

i hope any of this makes sense

Share this post


Link to post
Share on other sites
weaponx

Either i'm confused or you posted that incorrectly.

You can't do this:

case $msg = GUICtrlCreateTreeViewItem ($varr[1],$topitem)

Is that supposed to be:

case $msg = _GUICtrlListViewGetCurSel ( $h_listview )

EDIT: That doesn't look right either. I need to see more code.

Edited by weaponx

Share this post


Link to post
Share on other sites
alienkillaz

your right i wrote it wrong, here is the script. it needs an ini in the same folder with values like this:

(my.ini)

[john]

1=1

[bill]

1=1

[henry]

1=1

[crazyhorse]

1=1

what i am trying to accomplish is for the script to know which GUICtrlCreateTreeViewItem is being selected and then respond to that click based on wich GUICtrlCreateTreeViewItem it is.

what this is suposed to be is a database of employees and when u click thier name in the list it will bring up information on them.

#include <GUIConstants.au3>
GUICreate("moniter",680,400,-1,-1,BitOr($WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))
;CREATING THE TREE
$AllEmps=IniReadSectionNames("my.ini")
$MainTree = GUICtrlCreateTreeView (10,10,240,300)
$GeneralItem = GUICtrlCreateTreeViewItem ("Employees",$MainTree)
;BUTTONS
$SaveButton = GUICtrlCreateButton ("save",420,340,140,40)
$CancelButton = GUICtrlCreateButton ("Cancel",260,340,140,40)
PoulateEmpTree()
;GUIStartGroup
        $hey=""
For $i=1 to 5
        $Hey=$Hey&" "&$EmpTree[$i]
Next
    GUISetState()
While 1
    $Msg = GUIGetMsg()
    Select
    Case $Msg = -3 Or $Msg = -1 Or $Msg = $CancelButton
            ExitLoop
        case $Msg = $hey
            MsgBox(1,"","")
            
    case $Msg = $SaveButton 
            EndSelect
WEnd
GUIDelete()
Exit
;FUNCTIONS
Func PoulateEmpTree()
$Var=0
Global $EmpTree[10]
global $emptree[10]
Do
    $Var=$Var+1
    $EmpTree[$var] = GUICtrlCreateTreeViewItem ($AllEmps[$Var],$GeneralItem)

until $Var = $AllEmps[0]    
GUICtrlSetState ( $GeneralItem, $Gui_Show )

EndFunc

Share this post


Link to post
Share on other sites
therks

I'm not sure if this is what you need, but maybe you can work with it.

Switch and Select can use ranges with "To".

#include <GUIConstants.au3>

Dim $checkboxes[10]
$gui = GUICreate('', 200, 200)
For $i = 0 to 9
    $checkboxes[$i] = GUICtrlCreateCheckbox('Checkbox ' & $i, 0, $i * 20, 200, 20)
Next
GUISetState()

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case $checkboxes[0] To $checkboxes[9]
            GUICtrlSetBkColor($gm, Random(0, 0xffffff, 1))
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
alienkillaz

I'm not sure if this is what you need, but maybe you can work with it.

Switch and Select can use ranges with "To".

#include <GUIConstants.au3>

Dim $checkboxes[10]
$gui = GUICreate('', 200, 200)
For $i = 0 to 9
    $checkboxes[$i] = GUICtrlCreateCheckbox('Checkbox ' & $i, 0, $i * 20, 200, 20)
Next
GUISetState()

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case $checkboxes[0] To $checkboxes[9]
            GUICtrlSetBkColor($gm, Random(0, 0xffffff, 1))
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
is it possible to change that so that instead of

GUICtrlSetBkColor($gm, Random(0, 0xffffff, 1))

there was a msgbox what would tell me which $checkboxes was ativated?

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.