Sign in to follow this  
Followers 0
locutus243

finding a file

16 posts in this topic

I'm trying to open an explorer window and then select (i.e. highlight) a file within that folder. Opening the folder is easy enough but then highlighting a file is proving v.hard.

I can run the file, open the file, delete the file etc... but I only want to highlight it so I can use the right mouse button to perform a function.

Does anybody know how to do this?? I've tried FindFirstFile etc... and I can get it to search for the file but from there am not sure how to get my script to highlight the file.

Any help is much appreciated!!

Thanks

Mark

Share this post


Link to post
Share on other sites



This might get messy, but you may have to use the Mouse functions, but then you would have to contend with what view they are in. (Details, Thumbnails, etc)

Might also look into Control*() functions they may be of use. Trying using the Window Info Tool to figure out if you can tell what is highlighted. Then you could send some key strokes and check after each one to see if it is the file you are looking to highlight. Then you can also send keyboard messages to 'right click'.

Hope this helps some,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

What is the option you are trying to choose? There may be another way to get the same result you are looking for.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Thanks for your help.

Unfortunately thats why I can't use the mouse functions, too unreliable what with the files always moving around depending on view. The control function was my thought as well but then it seems the actual filenames themselves have no control details so I can't do anything like a control focus.

The closest idea I had was using the FindNextFile func, in a do loop sending the space and then down key each time until I get to the file I want, but I'm having some trouble with the scripting of it.

Thanks

Mark

Share this post


Link to post
Share on other sites

I am opening a shortcut for a Microsoft Access Query. If I just run it then it runs the query, but if I right click on it I can select to design the query which is what want to be able to do. I really wish there was a shortcut key for this!!!!

Mark

Share this post


Link to post
Share on other sites

Thanks for your help.

Unfortunately thats why I can't use the mouse functions, too unreliable what with the files always moving around depending on view. The control function was my thought as well but then it seems the actual filenames themselves have no control details so I can't do anything like a control focus.

The closest idea I had was using the FindNextFile func, in a do loop sending the space and then down key each time until I get to the file I want, but I'm having some trouble with the scripting of it.

Thanks

Mark

If it is a file you can use StatusbarGetText() function to check the date and size of the file (if you will know that before hand). Note this will not work on a folder (directory) at all.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I am opening a shortcut for a Microsoft Access Query. If I just run it then it runs the query, but if I right click on it I can select to design the query which is what want to be able to do. I really wish there was a shortcut key for this!!!!

Mark

Might want to do a little search on DBForums.com they may have some useful information on how you could make a shortcut that would just open the query in design view. You could even Google it. I am pretty sure there is a way to do it instead of just running the query.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

How do you do it manually? If I open a explorer window and see a file starting with c so I press c. Rotate by pressing c again. Typing a 2nd letter while the 1st is held dowm can jump you to that 2 letter march. If you want a file by exact name then you may need to consider a better method by direct means.

Share this post


Link to post
Share on other sites

Hey,

Unfortunately the properties of the file would be just as difficult to track as where it is within the folder. I'll hav a look on google for shortcuts through Access but if anything comes up then let me know.

Cheers

Mark

Share this post


Link to post
Share on other sites

There has to be a way to do this from a command line and once you figure out how to do that, applying it to auto it will be east.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I'm trying to open an explorer window and then select (i.e. highlight) a file within that folder. Opening the folder is easy enough but then highlighting a file is proving v.hard.

I can run the file, open the file, delete the file etc... but I only want to highlight it so I can use the right mouse button to perform a function.

Does anybody know how to do this?? I've tried FindFirstFile etc... and I can get it to search for the file but from there am not sure how to get my script to highlight the file.

Any help is much appreciated!!

Thanks

Mark

What about run ("explorer C:\Documents and Settings\filefolderlocation", C:\Documents and Settings\filefolderlocation)

WinWait (that folder)

Send the keys of the application name.ext this will highlight the file name.

Then send Shif and F10 to open the right click menu.

Edited by ChrisL

Share this post


Link to post
Share on other sites

Opening the folder with run explorer and then typing in the filename seems to work, but if theres any other suggestions I'd like to hear them, this is something thats annoyed me for ages now.

Mark

Share this post


Link to post
Share on other sites

All,

First off, I'm a newbie myself! Please feel free correct/flame as necessary.

Locutus,

Why bother with the mouse at all? B) Bearing in mind you can use the keyboard to run Windows, I used the recorder to build the script below. You should be able to adapt it to your needs. It uses Windows Key to run explorer, then cursor and Tab keys to "jump windows" and select the file (also bear in mind "first letter jump" in explorer). Finally the Apps (menu) key brings up the context menu and selects properties.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("classname=Shell_TrayWnd","")
If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")
WinWaitActive("classname=Shell_TrayWnd","")
Send("{LWINDOWN}{LWINUP}")
WinWait("Run","")
If Not WinActive("Run","") Then WinActivate("Run","")
WinWaitActive("Run","")
Send("explorer{ENTER}")
WinWait("My Documents","")
If Not WinActive("My Documents","") Then WinActivate("My Documents","")
WinWaitActive("My Documents","")
Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}")
WinWait("_Models","")
If Not WinActive("_Models","") Then WinActivate("_Models","")
WinWaitActive("_Models","")
Send("{TAB}{RIGHT}{APPSKEY}{UP}{ENTER}")
WinWait("YOURFILE.mdl Properties","")
If Not WinActive("YOURFILE.mdl Properties","") Then WinActivate("YOURFILE.mdl Properties","")
WinWaitActive("YOURFILE.mdl Properties","")
Send("{TAB}{TAB}{SHIFTDOWN}{TAB}{SHIFTUP}{TAB}{TAB}{ENTER}")

Share this post


Link to post
Share on other sites

Opening the folder with run explorer and then typing in the filename seems to work, but if theres any other suggestions I'd like to hear them, this is something thats annoyed me for ages now.

Mark

It sounds like you know the exact name of the file of interest... so:

Run('explorer.exe /e,/select, "C:\Temp\New Text document.txt"')

Should open the explorer with the file of interest selected.

Then Shift F10 from there.

have fun....


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

It sounds like you know the exact name of the file of interest... so:

Run('explorer.exe /e,/select, "C:\Temp\New Text document.txt"')

Should open the explorer with the file of interest selected.

Then Shift F10 from there.

have fun....

yeah, If we know the full path, we can have...

Run('explorer.exe /select, "C:\Temp\test.mdl"'); full path to file
sleep(1000); give the window time to open and accept messages
Send("{APPSKEY}r");Menu-Key+r = properties...
WinWait("test.mdl Properties","") 
If Not WinActive("test.mdl Properties","") Then WinActivate("test.mdl Properties","")

Which will bring to the Context-Menu, and Open the properties dialog.

Share this post


Link to post
Share on other sites

...if I right click on it I can select to design the query...

If you always want this mode - you can tell explorer to set the design view as the default action.

Open explorer > tools > folder options > file types

select the entry for MAQ

select "Advanced"

select/highlight "Design"

select "Set Default"

hope this helps........


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0