search file
-
- Posts: 90
- Joined: 23 Apr 2023, 13:03
search file
Is it possible to search for a PDF file with part of its name from one folder and copy it to another folder? Display a screen asking you to enter the search name. But I would like the search and destination folder to be extracted from a txt file. And when copying it renames by search name.
Re: search file
I can only answer for v1 if you want. So you want a gui to enter a text. A PDF file containing that text in the name should be the only result and it should get copied and renamed to the gui text input? (so no multiple files to look through).
For the txt file this is also possible but I only used iniread and iniwrite so far. So the question here would be do you create that txt file yourself or is it created and read by another programm so it has to stay as it is.
For the txt file this is also possible but I only used iniread and iniwrite so far. So the question here would be do you create that txt file yourself or is it created and read by another programm so it has to stay as it is.
-
- Posts: 90
- Joined: 23 Apr 2023, 13:03
Re: search file
May be for V1. The txt file I will create and leave in a folder. In this txt file goes the path of the folder that contains the files. But every month I will change the path that is inside the folder. I will compile the script to .exe. Searching from txt is better to change the path of the files.
Re: search file
So I think iniread/write would be fine then. Also I would add another edit or FileSelectFolder prompt to the GUI to change the path.
So for example:
Edit: You have to change FileCopy, C:\*%searchfor%*.pdf, C:\%searchfor%.pdf to your desired path of course.
So for example:
Edit: You have to change FileCopy, C:\*%searchfor%*.pdf, C:\%searchfor%.pdf to your desired path of course.
Code: Select all
startover:
IniRead, path, %temp%\test, path, path
Gui, Add, Text,,Search for
Gui, Add, Edit, vsearchfor
Gui, Add, Text,,in path
Gui, Add, Edit, vpath, %path%
Gui, Add, Button, gSearch ,Search, copy and paste
Gui, Add, Button, x+ gselpath ,Select path
Gui, Show
return
Search:
{ Gui, Submit, nohide
if (searchfor="" or path="")
msgbox You want to search for something in something
else
FileCopy, C:\*%searchfor%*.pdf, C:\%searchfor%.pdf
IniWrite, %path%, %temp%\test, path, path
}
return
selpath:
FileSelectFolder, pathnew,,,Select your Folder
Gui, Submit, nohide
IniWrite, %pathnew%, %temp%\test, path, path
Gui, Destroy
gosub startover
return