 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
Posted: Thu Aug 16, 2007 6:47 am Post subject: Invoking directly ContextMenu of Files and Folders |
|
|
It'll invoke the context menu of a file-system/virtual file or folder, without opening the explorer window.
DOWNLOAD ShellContextMenu.ahk.
Last edited by Sean on Tue Dec 01, 2009 1:01 am; edited 2 times in total |
|
| Back to top |
|
 |
Hardeep
Joined: 02 Jul 2006 Posts: 87
|
Posted: Thu Aug 16, 2007 10:50 am Post subject: |
|
|
I love these tricks you do with COM
Thanks |
|
| Back to top |
|
 |
Thalon-nli Guest
|
Posted: Mon Apr 28, 2008 7:00 pm Post subject: |
|
|
Thanks Sean!
That's what I actually was looking for  |
|
| Back to top |
|
 |
LBJ
Joined: 03 May 2007 Posts: 24
|
Posted: Mon May 05, 2008 12:44 pm Post subject: |
|
|
I've played with this for most of the afternoon now and I've looked at a lot of incomplete pieces of related information, but I can't make this work with a group of selected files rather than just one item.
Has anyone managed to expand on this to work with a set of files? If so, how did you mange it? |
|
| Back to top |
|
 |
sabot7726
Joined: 27 Nov 2006 Posts: 54
|
Posted: Tue Jul 22, 2008 11:51 am Post subject: |
|
|
Is it possible to add a portion of ahk scripting to the right click context menu?
For example:
Let's say I have a script called copypaste.ahk that copies and pastes something into another program. I would want to highlight a word and rightclick, then see an option there called copypaste where it can do the copy/paste operation.
Is that possible yet?  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
Posted: Wed Jul 23, 2008 3:29 am Post subject: |
|
|
| sabot7726 wrote: | | Is it possible to add a portion of ahk scripting to the right click context menu? | You're a bit vague on what you'd like to do. If you meant the explorer's context menu, you can do it by adding Shell Menu item, or by writing a ContextMenuHandler dll. If you meant the context menu of this script, you can do it without dll even at runtime, but I have no desire to release any further work on this. You may tweak the script yourself to your need as all needed ones for that were already put to the script. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
Posted: Wed Jul 23, 2008 4:02 am Post subject: |
|
|
| LBJ wrote: | | Has anyone managed to expand on this to work with a set of files? If so, how did you mange it? | How do you think Explorer does it? You can exactly do the same with the script. |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1317 Location: USA
|
Posted: Wed Jul 23, 2008 5:16 am Post subject: |
|
|
Once again, you have provided a great script for the community. I realize this is a bit old, but I just wanted to say thanks. _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 1019 Location: London, UK
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
|
| Back to top |
|
 |
pacifika
Joined: 27 Oct 2008 Posts: 8
|
Posted: Thu Nov 27, 2008 12:11 pm Post subject: |
|
|
Could someone please post a small ahk example showing how to utilize this script as I cannot get it to work, my app just loses focus and then regains it. _________________ Cheers |
|
| Back to top |
|
 |
pajenn
Joined: 07 Feb 2009 Posts: 349
|
Posted: Sun Feb 22, 2009 2:04 pm Post subject: |
|
|
Thank you for the scripts. I've added them to my C:\Program Files\AutoHotkey\Lib directory. I'm using the function to first invoke the context menu for a given file, then send keyboard inputs into the menu to navigate to the desired choice. Here's the code:
| Code: | DetectHiddenWindows, On ; not sure if necessary
DetectHiddenText, On ; not sure if necessary
ShellContextMenu("C:\test_file.txt")
Sleep, 200 ; to give conext menu time to pop-up
Send, {DOWN 12}{RIGHT}{DOWN 6}{ENTER} ; to select item
return
|
Problems:
1. The context menu for test_file.txt pops up next to the mouse cursor, but the "Send" commands do not go into it. I can manually select the option I want and it works though (in the attached pic I manually pressed down x 12, right, down x 6 to highlight "copy content."
2. Not all context menu items are included. The second pic shows the menu when I manually right-click on test_file.txt (incl. FastCopy, Scan with Rising, a-squared,...) - however, this is just fyi, as the menu I want is present.
Any advice would be appreciated - I'm new to AHK so even if I'm leaving out something obvious, I might not realize it.
 _________________ Hardware: 1.8 GHz laptop with 4 GB ram
Software: Windows XP/SP3, Rising Antivirus, Online Armor firewall, Dragon NaturallySpeaking Pro + Natlink (with Vocola/Unimacro) and AHK for macro support. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
Posted: Sun Feb 22, 2009 3:00 pm Post subject: |
|
|
| pajenn wrote: | | 1. The context menu for test_file.txt pops up next to the mouse cursor, but the "Send" commands do not go into it. I can manually select the option I want and it works though (in the attached pic I manually pressed down x 12, right, down x 6 to highlight "copy content." | The Send part will never run until the menu is closed. You have to use SetTimer for that.
| Quote: | | Not all context menu items are included. The second pic shows the menu when I manually right-click on test_file.txt (incl. FastCopy, Scan with Rising, a-squared,...) - however, this is just fyi, as the menu I want is present. | I suppose there was a problem to load/communicate with the corresponding ContextMenuHandler dlls. I can't tell the details unless I test them myself. |
|
| Back to top |
|
 |
pajenn
Joined: 07 Feb 2009 Posts: 349
|
Posted: Fri Mar 13, 2009 1:03 am Post subject: |
|
|
Just to follow up, I ended up using the status bar text to access the FileMenu Tools. However, I used ShellContextMenu for a script to find what's locking my drive, for example, when a flash drive refuses to eject. Below is the main script - I use AltGr+U followed by the letter of the drive I want to unlock. I'm using WhoLockMe for the underlying unlocker, but Unlocker is good too (both are free):
| Code: | <^>!u::
Input, locked, T3 L1, {esc}, c, i, j, k, l, z
SetKeyDelay, -1
Run WhoLockMe.ahk
Sleep, 500
if locked = c
ShellContextMenu("C:\")
else if locked = i
ShellContextMenu("I:\")
else if locked = j
ShellContextMenu("J:\")
else if locked = k
ShellContextMenu("K:\")
else if locked = l
ShellContextMenu("L:\")
else if locked = z
ShellContextMenu("Z:\")
return |
Here's my WhoLockMe.ahk script with SetTimer. It uses MenuSelectItem function from the linked post by Lexikos with UseMouse = True. (With UseMouse = False the function sometimes selects the context menu item above the one I specify...)
| Code: | #Persistent
SetTimer, WhoLockMe, 500
return
WhoLockMe:
IfWinNotExist, ahk_class #32768
return
SetTimer, WhoLockMe, Off ;timer off if context menu detected
MenuSelectItem("Who Lock Me ? ...")
GoSub, WhoLockExit
return
WhoLockExit:
Sleep, 1000
ExitApp
return |
Not sure you need the WhoLockExit subroutine in this case, but I needed it to access submenus with some other context menu scripts. Again, this seems to work fine for me, but I have only used it a little bit... _________________ Hardware: 1.8 GHz laptop with 4 GB ram
Software: Windows XP/SP3, Rising Antivirus, Online Armor firewall, Dragon NaturallySpeaking Pro + Natlink (with Vocola/Unimacro) and AHK for macro support. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2222
|
Posted: Fri Mar 13, 2009 1:40 am Post subject: |
|
|
| pajenn wrote: | | Just to follow up, I ended up using the status bar text to access the FileMenu Tools. | I don't know how you use it, however, you can obtain the status bar help text of menu item using
| Code: | VarSetCapacity(sHelp,63)
DllCall(NumGet(NumGet(1*pcm)+20), "Uint", pcm, "Uint", idCommand, "Uint", GCS_HELPTEXTA:=1, "Uint", 0, "str", sHelp, "Uint", 64) ; GetCommandString |
Just FYI. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|