DanielVibuso Posted March 23, 2021 Share Posted March 23, 2021 Hi guys, i'm beginner with autoit! I'm trying copy and paste same files. What i want to do: insert initial number and last number of the files, so copy & past them. but, if I put value 10 on last number, this looks like as if I inserted value 6. can you help me? expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ;Text ="1", Left = 54, Top = 138, Width = 36, Height = 29 criaForm() Func criaForm() Local $hGUI = GUICreate("MoveNotas") Local $idBtnDirOrigin = GUICtrlCreateButton("Selecionar Diretorio origem", 50, 50, 200, 25) Local $idBtnDirDestiny = GUICtrlCreateButton("Selecionar Diretorio origem", 300, 50, 200, 25) Local $idEdtInitialValue = GUICtrlCreateInput("", 50, 100, 50, 20) Local $idEdtEndValue = GUICtrlCreateInput("", 100, 100, 50, 20) Local $idOK = GUICtrlCreateButton("fechar", 310, 370, 85, 25) Local $idBtnCopyAll = GUICtrlCreateButton("Copiar notas", 50, 200, 70, 25) Local $dirOrigin = "" Local $dirDestiny = "" ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $idBtnDirOrigin $dirOrigin = selectDir("Origem") Case $idBtnDirDestiny $dirDestiny = selectDir("Destino") Case $idBtnCopyAll copyNF($idEdtInitialValue, $idEdtEndValue, $dirOrigin, $dirDestiny) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func selectDir($type_dir) ; Create a constant variable in Local scope of the message to display in FileSelectFolder. Local Const $sMessage = "Selecione a pasta " & $type_dir ; Display an open dialog to select a file. Local $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "Nenhuma pasta foi selecionada.") Else ; Display the selected folder. MsgBox($MB_SYSTEMMODAL, "", "você escolheu a pasta:" & @CRLF & $sFileSelectFolder) EndIf Return $sFileSelectFolder EndFunc Func copyNF($initVal, $endVal, $fromDir, $toDir) MsgBox($MB_SYSTEMMODAL, "", "init val: " & $initVal & @CRLF & " endVal: " & $endVal & @CRLF & " fromDir: " & $fromDir & @CRLF & " To dir: " & $toDir) For $i = $initVal To $endVal Step 1 FileCopy($fromDir & "\" & $i & ".xml", $toDir & "\") Next MsgBox($MB_SYSTEMMODAL, "", "Copiado com sucesso") EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2021 Moderators Share Posted March 23, 2021 DanielVibuso, Welcome to the AutoIt forums. You need to use GUICtrlRead to get the value of the controls - what you are getting currently is the internal index number of the control in AutoIt's internal array of controls. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
DanielVibuso Posted March 23, 2021 Author Share Posted March 23, 2021 10 minutes ago, Melba23 said: DanielVibuso, Welcome to the AutoIt forums. You need to use GUICtrlRead to get the value of the controls - what you are getting currently is the internal index number of the control in AutoIt's internal array of controls. M23 Thank you! This worked fine! God Bless you, my friend! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2021 Moderators Share Posted March 23, 2021 DanielVibuso, Delighted I could help. But when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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