search, find and open the specified filename in the corresponding folder. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

search, find and open the specified filename in the corresponding folder.

22 Jan 2018, 03:30

There is a folder called "document" under the C drive. There are several folders in this folder. I give a folder from 1 to 20 folders. Let's say folder names 1, 2, 3 continue to 4 .... 20. "1234.pdf" file exists in any folder. The path to the folder is not clear.

I want to;

I put 1234 (file name) into the editbox and when I press the buton, it will search for and open the 1234.pdf file in the folders in the path c: \ document \.

Code: Select all

Gui, Add, Button, x312 y80 w100 h40 , Find & Run
Gui, Add, Edit, x82 y80 w190 h30 , 1234
Gui, Add, Text, x12 y270 w440 h20 , Desination Folder C:\Document\
; Generated using SmartGUI Creator for SciTE
Gui, Show, w479 h305, Untitled GUI
return

GuiClose:
ExitApp
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: search, find and open the specified filename in the corresponding folder.

22 Jan 2018, 05:25

Code: Select all

#SingleInstance, Force
SetBatchLines -1

F10::
Gui, Add, Edit,   x10  y24   w180 h24 vdestFolder, C:\Users    ; NO trailing backspace !
Gui, Add, Edit,   x10  yp26  w90  h24 vfilename  , *.ini       ; provide full filename WITH extension!
Gui, Add, Button, x100 yp-1  w91  h26 gSearch    , Search ...  ; a search will probably take some time!
Gui, Show, w200 h98, `t
Return

GuiClose:
   ExitApp

Search:
   Gui, Submit, NoHide
   ClipBoard := ""
   Run, cmd /c where /r "%destFolder%" %filename% /f | clip ,, Hide
   ClipWait
   MsgBox % ClipBoard   ; replace this MsgBox with a loop that extracts the path of every file for further processing
   Return
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: search, find and open the specified filename in the corresponding folder.

23 Jan 2018, 02:51

BoBo wrote:

Code: Select all

#SingleInstance, Force
SetBatchLines -1

F10::
Gui, Add, Edit,   x10  y24   w180 h24 vdestFolder, C:\Users    ; NO trailing backspace !
Gui, Add, Edit,   x10  yp26  w90  h24 vfilename  , *.ini       ; provide full filename WITH extension!
Gui, Add, Button, x100 yp-1  w91  h26 gSearch    , Search ...  ; a search will probably take some time!
Gui, Show, w200 h98, `t
Return

GuiClose:
   ExitApp

Search:
   Gui, Submit, NoHide
   ClipBoard := ""
   Run, cmd /c where /r "%destFolder%" %filename% /f | clip ,, Hide
   ClipWait
   MsgBox % ClipBoard   ; replace this MsgBox with a loop that extracts the path of every file for further processing
   Return

If the file name contains "-" "space" characters, the search result does not find anything. I also do not want to write the file extension in EditBox. Let's add the file extensions into a combobox next to it. I want to find the extension we want and just want to find the name of the file.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: search, find and open the specified filename in the corresponding folder.  Topic is solved

23 Jan 2018, 03:03

Code: Select all

Gui, Add, Edit,   x10  yp26  w90  h24 vfilename  ,           ; provide full 
...
Run, cmd /c where /r "%destFolder%" "%filename%.pdf" /f | clip ,, Hide
Nice greetings from Germany :D :D
chngrcn wrote:... Let's add the file extensions into a combobox next to it. ...
That's your job :mrgreen: :mrgreen:
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: search, find and open the specified filename in the corresponding folder.

23 Jan 2018, 03:19

divanebaba wrote:

Code: Select all

Gui, Add, Edit,   x10  yp26  w90  h24 vfilename  ,           ; provide full 
...
Run, cmd /c where /r "%destFolder%" "%filename%.pdf" /f | clip ,, Hide
Nice greetings from Germany :D :D
chngrcn wrote:... Let's add the file extensions into a combobox next to it. ...
That's your job :mrgreen: :mrgreen:
thanks divanebaba. Very Nice Greetings from turkey .. :mrgreen: :mrgreen: in the file name "-" "space" as the file name when the characters do not seek. Does it have a solution?
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: search, find and open the specified filename in the corresponding folder.

23 Jan 2018, 03:21

chngrcn wrote:... in the file name "-" "space" as the file name when the characters do not seek. Does it have a solution?
I'm sorry. I do not understand. Can you write a bit different?

BTW: It was BoBo who has offer your solution. I just made a very little correction for your detailed issue.
The honor is due to BoBo.
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: search, find and open the specified filename in the corresponding folder.

23 Jan 2018, 03:57

for english

the name of the file searched for: divanebaba-23 chngrcn.pdf
the file name does not search when there are spaces and characters such as "-".
can we find a solution?


for turkish

aranan dosyanın adı mesela : divanebaba-23 chngrcn.pdf
dosya adı içinde, boşluk ve "-" gibi karakterler olduğu zaman arama yapmıyor.
çözüm bulabilirmiyiz ?

for german

Der Name der gesuchten Datei: divanebaba-23 chngrcn.pdf
Der Dateiname sucht nicht, wenn Leerzeichen und Zeichen wie "-" vorhanden sind.
Können wir eine Lösung finden?
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: search, find and open the specified filename in the corresponding folder.

23 Jan 2018, 04:17

This problem is fixed. I've tested with a bunch of spaces and really crazy names.
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: search, find and open the specified filename in the corresponding folder.

24 Jan 2018, 02:57

I try different file names but can not find them. do not find the Turkish characters in the file name?
* .pdf is not. I write the direct file name, can not find the file.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: search, find and open the specified filename in the corresponding folder.

24 Jan 2018, 14:44

Hi.
This code

Code: Select all

Run, cmd /c where /r "%destFolder%" "%filename%.pdf" /f | clip ,, Hide
looks only for pdf-files.
To search for, you have to prevent typing the filetype-mime.
Cihan.jpg
Cihan.jpg (6.76 KiB) Viewed 1316 times
I've tested with turkish characters and it works.

As I said, the code I've corrigated looks only for pdf-files and this only, when you don't type the mime-type.
In my example, filename was Şeşı - gğ.pdf but into the search field I just have typed Şeşı - gğ.
You said
chngrcn wrote:... I also do not want to write the file extension in EditBox. Let's add the file extensions into a combobox next to it. ...
If you later insert a ComboBox for your filetypes, we can change the code to match even them.
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: search, find and open the specified filename in the corresponding folder.

30 Jan 2018, 02:09

THANK YOU. PROBLEM SOLVED. "% filename% .pdf" in quotes solved the job. made a point shot.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, doodles333, Nerafius, ShatterCoder and 71 guests