Sign in to follow this  
Followers 0
EndFunc

SelectAll Listbox

7 posts in this topic

Can't seem to find syntax for it or one that I can manipulate to do but is there a select all for a List box.

_GUICtrlListSelItemRange() doesnt seem to help as it needs a start and stop. Any suggestions?


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites



Can't seem to find syntax for it or one that I can manipulate to do but is there a select all for a List box.

_GUICtrlListSelItemRange() doesnt seem to help as it needs a start and stop. Any suggestions?

NM I think I found it. _GUICtrlListSetSel() :shocked:


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

NM I think I found it. _GUICtrlListSetSel() :shocked:

Ok I do have question. Is there a way to have _GUICtrlListDeleteItem remove a specific item from a list box and not just top most item? Also to make sure its selected first?


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

Ok I do have question. Is there a way to have _GUICtrlListDeleteItem remove a specific item from a list box and not just top most item? Also to make sure its selected first?

$SList = _GUIListGetSelItems($My_ListCtrl) ;Returns an array of the selected Items

For $I = 1 To Ubound($SList)-1

_GUIListDeleteItem($My_ListCtrl,$SList[$I]); deletes the item

Next


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$SList = _GUIListGetSelItems($My_ListCtrl) ;Returns an array of the selected Items

For $I = 1 To Ubound($SList)-1

_GUIListDeleteItem($My_ListCtrl,$SList[$I]); deletes the item

Next

Thanks alot that was very helpful!

I have a problem with trying to get this to tell me if it is a dir or a file. The code I tried using a stringinstr and using a "." won't work. It has the opposite effect. I want it to tell me if it is a file by having a "." in and if not it's a dir. Any other suggestions??

Dim $sCount = _GUICtrlListCount($SourceEdit)
If $sCount = "0" Then
GUICtrlSetData($Console,"No additional files or folders selected during this process." & @CRLF & @CRLF, 1)
Else
$sAll = _GUICtrlListSetSel($SourceEdit, 0)
            If($sAll == $LB_ERR) Then
                MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
            EndIf
$ret = _GUICtrlListGetSelItemsText ($SourceEdit)
            If (Not IsArray($ret)) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItemsText")
            Else
            
                For $i = 1 To $ret[0]
                If $ret[$i] = StringInStr($ret[$i], ".") Then               
                MsgBox(0, "Selected files", $ret[$i])
                GUICtrlSetData($Console, $ret[$i] & " has been added to transfer." & @CRLF, 1)
                GUICtrlSetData($Console, "Transfering " & $ret[$i] & @CRLF, 1)
                EndIf
                Next
            EndIf
Edited by EndFunc

EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks alot that was very helpful!

I have a problem with trying to get this to tell me if it is a dir or a file. The code I tried using a stringinstr and using a "." won't work. It has the opposite effect. I want it to tell me if it is a file by having a "." in and if not it's a dir. Any other suggestions??

Dim $sCount = _GUICtrlListCount($SourceEdit)
If $sCount = "0" Then
GUICtrlSetData($Console,"No additional files or folders selected during this process." & @CRLF & @CRLF, 1)
Else
$sAll = _GUICtrlListSetSel($SourceEdit, 0)
            If($sAll == $LB_ERR) Then
                MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
            EndIf
$ret = _GUICtrlListGetSelItemsText ($SourceEdit)
            If (Not IsArray($ret)) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItemsText")
            Else
            
                For $i = 1 To $ret[0]
                If $ret[$i] = StringInStr($ret[$i], ".") Then               
                MsgBox(0, "Selected files", $ret[$i])
                GUICtrlSetData($Console, $ret[$i] & " has been added to transfer." & @CRLF, 1)
                GUICtrlSetData($Console, "Transfering " & $ret[$i] & @CRLF, 1)
                EndIf
                Next
            EndIf

If $ret[$i] = StringInStr($ret[$i], ".") Then

is wrong.

If StringInStr($Ret[$i], ".") Then

Better yet if you have the full file path

If Not StringInStr(FileGetAttrib($Ret[$I]),"D") Then
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

is wrong.

If StringInStr($Ret[$i], ".") Then

Better yet if you have the full file path

If Not StringInStr(FileGetAttrib($Ret[$I]),"D") Then
Man, you're a life saver. Works perfectly. Thank you! :shocked:

EndFuncAutoIt is the shiznit. I love it.

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