billthecreator Posted September 27, 2008 Share Posted September 27, 2008 (edited) ok, so i have a system that splits the string into an array: $array = "This1|This2|That3|That4" and i also have it so it just shows the number part. ( note: the number part is always different ) it shows in a list: 1 2 3 4 i want to know if i click '3' and delete it from the list box, how can i delete it from the array (That3), with it not being the whole string? Edited September 27, 2008 by billthecreator [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
sandin Posted September 27, 2008 Share Posted September 27, 2008 maybe something like this: expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 206, 179);, 193, 125) $Button1 = GUICtrlCreateButton("Display Array", 16, 24, 161, 33, 0) $Button2 = GUICtrlCreateButton("Delete Array Item", 16, 72, 161, 33, 0) $Button3 = GUICtrlCreateButton("Say String", 16, 120, 161, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $array_count = InputBox("Array", "How many elements you want in your array?", "4") if @error then Exit $string = "" for $i = 1 to $array_count if $string = "" Then $string = "This" & $i Else $string &= "|This" & $i EndIf Next $string_split = StringSplit($string, "|") dim $array1[$string_split[0]+1] for $i = 1 to $string_split[0] $array1[$i] = StringTrimLeft($string_split[$i], 4) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button3 MsgBox(0, "your string is:", $string) case $Button1 _ArrayDisplay($array1) case $Button2 Local $question = InputBox("Delete Array Item", "Input number of the item you would like to delete", "3") if NOT @error Then _ArrayDelete($array1, Number($question)) $string = "" for $i = 1 to UBound($array1)-1 if $string = "" Then $string = "This" & $array1[$i] Else $string &= "|This" & $array1[$i] EndIf Next EndIf EndSwitch WEnd Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
billthecreator Posted September 27, 2008 Author Share Posted September 27, 2008 (edited) ok, but, really this is for attachments in an email program. i have the shortname of the attached file in the list box, but if you delete it, it just deletes the list data, not the actual array section. Case $Attach $ATTACHFILE = FileOpenDialog("Attach File", "", "All Files (*.*)", 5) If @error Then Else $s_AttachFiles = $ATTACHFILE $ATTACHFILE = StringSplit($ATTACHFILE, "|") If $ATTACHFILE[0] = 1 Then GUICtrlSetData($AttachList, _GetShortName($ATTACHFILE[1]) & "|") $f_size = $f_size +FileGetSize($ATTACHFILE[1]) Else For $r = 2 To $ATTACHFILE[0] GUICtrlSetData($AttachList, _GetShortName($ATTACHFILE[$r]) & "|") $f_size = $f_size + FileGetSize($ATTACHFILE[$r]) Next EndIf EndIf GUICtrlSetData($File_sizes, Round($f_size/1024) & " KB") Case $FileDelete _GUICtrlListBox_DeleteString($AttachList, _GUICtrlListBox_GetCurSel($AttachList)) ;this is where i want to delete the array section. Edited September 27, 2008 by billthecreator [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
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