Sign in to follow this  
Followers 0
igloblausa

Getting items from a listbox

5 posts in this topic

post-16340-1161905386_thumb.jpg I created a listbox for displaying files that I have chosen using FileOpen Dialog(). How do I get the items from the listbox and copy them to a folder? Any help would be appreciated. See attached image.

Share this post


Link to post
Share on other sites



welcome to the forums... nice first post!

$info = GUICtrlRead($Listbox)

fileCopy()

see help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

post-16340-1161905386_thumb.jpg I created a listbox for displaying files that I have chosen using FileOpen Dialog(). How do I get the items from the listbox and copy them to a folder? Any help would be appreciated. See attached image.

Thanks a bunch for your assistance, Valuater. I will also be checking out your AutoIt 123 and your XSkin scripts.

Share this post


Link to post
Share on other sites

welcome to the forums... nice first post!

$info = GUICtrlRead($Listbox)

fileCopy()

see help

8)

Thanks for the solution, Valuater. It seems to work but it forces me to single-select the items in the listbox for FileCopy() to work otherwise no files are copied, here is part of the code:

Case $msg = $encrypt_btn

;verify that listbox not empty by getting items count of listbox

$count = _GUICtrlListCount ($listbox)

If $count = 0 Then

MsgBox(48, "ListBox Status", "No selected files to encrypt!") ;48 flag = Exclmation point icon

Else

;clear seal encryption files

clear_encrypt()

;get files from list box

$get_items = GUICtrlRead($listbox, 1)

;copy list items from $listbox to seal folder for encryption

$error = FileCopy($get_items,"c:\seal\files",1)

If $error = 0 Then

MsgBox(48,"","No File(s) selected for encryption!")

(I get this error message since no files are copied if I don't select the items in the $listbox.

Does the GUICtrlRead() requires one to select the items in the $listbox before FileCopy()

can use the items? If yes, is there a common or extended control to do a multiselect?

Else

;clear listbox

_GUICtrlListClear ($listbox)

;open splash text

SplashTextOn("Encryption Status", "Encrypting selected file(s). Please wait!", 300, 100, -1, -1, 0, "", 12, 1000)

;run batch file to encrypt selected file(s), script waits until batch file closes

$batch_err = RunWait("c:\seal\seal.bat", "c:\seal", @SW_HIDE)

.

.

.

Does GuiCtrlCreateList() have a Common or Extended Style to allow it to do a multiselect of items in the listbox? e.g. $listbox = GUICtrlCreateList("", 20, 90, 340, 150, -1, $LBS_MULITSELECT) $LBS_MULTISELECT does not exist (sample only). I can only find $LBS_NOSEL in the GUI Control Sytles table of common and extended styles. I would appreciate your expert input. Thanks in advance.

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