youtuber Posted April 25, 2018 Share Posted April 25, 2018 I want to move the selected file My problem is the following lines Case $Button1 For $s = 0 To _GUICtrlListView_GetItemCount($ListV1) - 1 If _GUICtrlListView_GetItemChecked($ListV1, $s) Then FileMove(@ScriptDir & "\" & $s, @DesktopDir & "\" & $s, $FC_OVERWRITE) EndIf Next And all the codes expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <GuiListView.au3> Global $fTypes = "bmp|gif|png|jpg" $Form1 = GUICreate("Form1", 259, 296, 192, 124) $ListV1 = GUICtrlCreateListView("ListView 1", 32, 32, 186, 182, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) FindFiles() $Button1 = GUICtrlCreateButton("Button1", 88, 232, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $s = 0 To _GUICtrlListView_GetItemCount($ListV1) - 1 If _GUICtrlListView_GetItemChecked($ListV1, $s) Then FileMove(@ScriptDir & "\" & $s, @DesktopDir & "\" & $s, $FC_OVERWRITE) EndIf Next EndSwitch WEnd Func FindFiles($sType = "All Types") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListV1)) Local $ext = "*." & $sType, $FL2A If $sType = "All Types" Then $ext = "*.*" $FL2A = _FileListToArray(@ScriptDir, $ext, 1) If Not @error Then For $i = 1 To $FL2A[0] If $sType = "All Types" Then Local $SST = StringSplit($fTypes, "|") For $j = 1 To $SST[0] If $SST[$j] = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _ GUICtrlCreateListViewItem($FL2A[$i], $ListV1) Next ElseIf $sType <> "All Types" Then If $sType = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _ GUICtrlCreateListViewItem($FL2A[$i], $ListV1) EndIf Next _GUICtrlListView_SetColumnWidth($ListV1, 0, $LVSCW_AUTOSIZE) EndIf EndFunc ;==>FindFiles Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2018 Share Posted April 25, 2018 $s is a number, what exactly do you think is going to happen with that FileMove function call? Don't you think you might need a GUICtrlRead, _GUICtrlListView_GetItemText or something similar in there somewhere? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
youtuber Posted April 25, 2018 Author Share Posted April 25, 2018 I think it should be something like this, but I have not been successful For $s = 0 To _GUICtrlListView_GetItemCount($ListV1) - 1 If _GUICtrlListView_GetItemChecked($ListV1, $s) Then $SelectFile = GUICtrlRead(_GUICtrlListView_GetItemText($ListV1, $s)) FileMove(@ScriptDir & "\" & $SelectFile, @DesktopDir & "\" & $SelectFile, $FC_OVERWRITE) EndIf Next Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2018 Share Posted April 25, 2018 I can imagine that it wouldn't work with that line. Try this $SelectFile = _GUICtrlListView_GetItemText($ListV1, $s) youtuber 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
youtuber Posted April 25, 2018 Author Share Posted April 25, 2018 @BrewManNH Thank you, I can not make more than one File move do you have a suggestion for it? Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2018 Share Posted April 25, 2018 If there's more than one checked, that should move them one at a time. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
youtuber Posted April 25, 2018 Author Share Posted April 25, 2018 @BrewManNH Yes, how do I move multiple files? Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2018 Share Posted April 25, 2018 FileMove will only work with one file at a time unless you use wildcards, which won't work here. All of the other functions like it, FileCopy DirCopy etc., will have the same limitations. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
youtuber Posted April 25, 2018 Author Share Posted April 25, 2018 @BrewManNH How should this code be for multiple file move? FileMove(@ScriptDir & "\" & $SelectFile, @DesktopDir & "\", $FC_OVERWRITE) Link to comment Share on other sites More sharing options...
BrewManNH Posted April 26, 2018 Share Posted April 26, 2018 16 hours ago, BrewManNH said: FileMove will only work with one file at a time unless you use wildcards, which won't work here. I thought I was clear here. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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