topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 5:40 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Open the corresponding folder of the found files  (Read 6903 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Open the corresponding folder of the found files
« on: July 31, 2012, 02:25 PM »
Open the corresponding folder of the found files

I would like a soft for :

Open the corresponding folder of the found files.

suppose I would like to find the file "abc.txt" in one of my hard disks.

When the file is found the corresponding folder is opened. That's the idea.

I suppose if many files are encountered may be problem with the memory or the operative system. So better is possible open in series.

Best Regards
 :-*

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,149
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #1 on: July 31, 2012, 04:23 PM »
"found files" ? Where? In WinExplorer?
In WinExplorer there is an option to open the parent folder (try context menu) already.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #2 on: July 31, 2012, 05:53 PM »
Open folder automatically when the file is found
I have to do nothing
 :P

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #3 on: July 31, 2012, 07:10 PM »
How are you finding the file?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #4 on: July 31, 2012, 08:23 PM »
OpenFolderThatHas filename

Opens every folder on the drive the script is run from, that contains a file filename. May use wildcards like *.cmd or *.txt. It only accepts one argument.  filename

It opens the folder and waits until the window is closed to do the next Loop.

Edit: prompts for filename if none on command line. Enter just a filename, no drive or path (e.g. readme.txt)

if 0 < 1
{
  InputBox,filename,,Enter File Name with no path
  if (ErrorLevel)
    ExitApp
}
else
  filename = %1%
tmp := A_ScriptDir
StringLeft,drive,tmp,3
FilePat := drive filename
Loop, %FilePat%,,1
{
  tmp := _FileDir(A_LoopFileLongPath)
  ;MsgBox, 8256, Test, %A_LoopFileLongPath%`n%tmp%
  Run,%tmp%
  WinWaitActive,%tmp%,,5
  if (ErrorLevel)
    continue
  while WinExist(tmp)
  {
    Sleep,250
  }
}

_FileDir(path)
{
  SplitPath,path,,fdir
  return fdir
}

edit: I removed the "#notrayicon" so it can be killed via tray icon to break the loop. Also note that it waits until a window with the title that matches the folder name no longer exists. If you happen to have the same folder already open, it will hang. So close all explorer windows before running, or fix the script. :)
« Last Edit: August 01, 2012, 09:48 PM by MilesAhead »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #5 on: August 01, 2012, 07:45 PM »
How are you finding the file?

I suppose with the same program used to open the folder.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #6 on: August 01, 2012, 07:46 PM »
How are you finding the file?

I suppose with the same program used to open the folder.



Trying

I will comment
 :-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #7 on: August 01, 2012, 07:48 PM »
OpenFolderThatHas filename

Opens every folder on the drive the script is run from, that contains a file filename. May use wildcards like *.cmd or *.txt. It only accepts one argument.  filename

It opens the folder and waits until the window is closed to do the next Loop.

if 0 < 1
{
  MsgBox, 8256, Open Folder That Has, Usage: ofth filename
  ExitApp
}
filename = %1%
tmp := A_ScriptDir
StringLeft,drive,tmp,3
FilePat := drive filename
Loop, %FilePat%,,1
{
  tmp := _FileDir(A_LoopFileLongPath)
  ;MsgBox, 8256, Test, %A_LoopFileLongPath%`n%tmp%
  Run,%tmp%
  WinWaitActive,%tmp%,,5
  if (ErrorLevel)
    continue
  while WinExist(tmp)
  {
    Sleep,250
  }
}

_FileDir(path)
{
  SplitPath,path,,fdir
  return fdir
}

edit: I removed the "#notrayicon" so it can be killed via tray icon to break the loop. Also note that it waits until a window with the title that matches the folder name no longer exists. If you happen to have the same folder already open, it will hang. So close all explorer windows before running, or fix the script. :)


Owwww. I think I made a mistake in the post above.
Really I wanted to quote this post

Trying

Best Regards
 :-[

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #8 on: August 01, 2012, 07:53 PM »
Don't ask me the name of the file ?
I double click but only obtain an error window.

Usage: ofth filename

Accept

What can I do now ?

Going to study the commands to see what I have to understand in the script.

 :-[

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #9 on: August 01, 2012, 08:23 PM »
Don't ask me the name of the file ?
I double click but only obtain an error window.

Usage: ofth filename

Accept

What can I do now ?

Going to study the commands to see what I have to understand in the script.

 :-[

See code I posted above. I shows an inputbox if no file on command line.
« Last Edit: August 01, 2012, 08:50 PM by MilesAhead »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #10 on: August 04, 2012, 06:32 AM »
Hi everybody,
i am really shoked. because i lost my files lasy two day's. and now i am trying to my best for find these  files . i saved my files in my desktop folder. but it is now shown that corresponding folder. that's why i do not find my files. now what can i do for finding my files.

Hello batlon13.
I suppose you need the help of someone like me  :-[
Trying
Sometimes a simple click can move a folder to another place.
If you know the name of some of the files you lost I think you can recover. Even possibly the files are in the trash folder.
You can try to find them with Windows Explorer, or Locate32 (a powerful search program)
Happen me in the past that visiting any folder I found the lost folder some time ago....
 :-*

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Open the corresponding folder of the found files
« Reply #11 on: August 04, 2012, 07:37 PM »
Or immediately after you've done the action, you can right-click on the Desktop and select Undo .... for the last action.