PDA

View Full Version : How do I explore to folder and target file?



fid
10-13-2009, 05:43 AM
I'm wondering how to open explorer to the target file's location and also select that filename. I know how to make it open the target folder, but I can't figure out how to make it select the file too. Hopefully this makes sense.

Thanks in advance for any guidance.

jassing
10-13-2009, 11:04 AM
AFAIK there is no api to accomplish this -- you could easily use autoit to script that added functionality.

Tone
10-13-2009, 04:55 PM
Script / Add Action / File / File.run / Next / click on "AutoPlay\\Docs\\MyProg.exe" / browse to file

Hope this works for you ;)

Imagine Programming
10-13-2009, 05:22 PM
Use the next function to open a new explorer window and select the given folder/file.



function ExploreSelect(sPath)
File.Run(_WindowsFolder.."\\explorer.exe", "/select,\""..sPath.."\"", "", SW_SHOWNORMAL, false);
end


Then call it like (example)


ExploreSelect(_WindowsFolder.."\\notepad.exe");

longedge
10-14-2009, 01:23 AM
Forgive the question, I'm sure that I must be missing something but, if you want to 'Explore' to a known folder/file and then open it, why not just use File.Run?

Imagine Programming
10-14-2009, 03:17 AM
people, he wants to open the folder in explorer and select a file in it. You know, a 'browse to file in itunes' kinda thing :p

longedge
10-14-2009, 06:39 AM
people, he wants to open the folder in explorer and select a file in it. You know, a 'browse to file in itunes' kinda thing :p

I was looking at -

the target file ..... make it select the file too

I sometimes make the mistake of reading things too literally :)

rexzooly
10-14-2009, 06:41 AM
Nice function Imagine Programming :yes

Imagine Programming
10-14-2009, 12:59 PM
I sometimes make the mistake of reading things too literally :)

Yeah I understand, sometimes I do that too lol. :yes


Nice function Imagine Programming :yes

Thank you, I recall I had some help from the IR community on this subject a big while back, so there should be a thread about it somewhere :p

fid
10-16-2009, 06:58 AM
Use the next function to open a new explorer window and select the given folder/file.



function ExploreSelect(sPath)
File.Run(_WindowsFolder.."\\explorer.exe", "/select,\""..sPath.."\"", "", SW_SHOWNORMAL, false);
end


Then call it like (example)


ExploreSelect(_WindowsFolder.."\\notepad.exe");


This is EXACTLY what I needed. Thank you!!!!

k1ngk1ng
10-16-2009, 10:25 AM
nice work 'Imagin programing'!!:D

let me explain more::o

these are the useful explorer parameter"

Option Function
----------------------------------------------------------------------
/n Opens a new single-pane window for the default selection. This is usually the root of the drive that Windows is installed on. If the window is already open, a duplicate opens.

/e Opens Windows Explorer in its default view.

/root,<object> Opens a window view of the specified object.

/select,<object> Opens a window view with the specified folder, file,or program selected.

Examples
-----------------------------------------------------------------------
Example 1: Explorer /select,C:\TestDir\TestProg.exe
Opens a window view with TestProg selected.

Example 2: Explorer /e,/root,C:\TestDir\TestProg.exe
Opens Explorer with drive C expanded and TestProg selected.

Example 3: Explorer /root,\\TestSvr\TestShare
Opens a window view of the specified share.

Example 4: Explorer /root,\\TestSvr\TestShare,select,TestProg.exe
Opens a window view of the specified share with TestProg selected.


Explorer.exe /e,/idlist,%I,%L From Folder\..\Explore in the registry

%I - ID number

%L - Long filename