search file

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Felix Siano
Posts: 90
Joined: 23 Apr 2023, 13:03

search file

05 Aug 2023, 12:22

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.
Master_X
Posts: 33
Joined: 04 Aug 2023, 13:59

Re: search file

05 Aug 2023, 16:10

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.
Felix Siano
Posts: 90
Joined: 23 Apr 2023, 13:03

Re: search file

05 Aug 2023, 16:40

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.
Master_X
Posts: 33
Joined: 04 Aug 2023, 13:59

Re: search file

06 Aug 2023, 04:22

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.

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

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: No registered users and 43 guests