AutoHotkey Community

It is currently May 26th, 2012, 9:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 62 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
PostPosted: August 16th, 2007, 6:47 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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 December 1st, 2009, 1:01 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 16th, 2007, 10:50 am 
Offline

Joined: July 2nd, 2006, 7:59 pm
Posts: 87
I love these tricks you do with COM :D

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 28th, 2008, 7:00 pm 
Thanks Sean!
That's what I actually was looking for :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2008, 12:44 pm 
Offline

Joined: May 3rd, 2007, 5:59 am
Posts: 24
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 22nd, 2008, 11:51 am 
Offline

Joined: November 27th, 2006, 3:06 pm
Posts: 69
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? :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2008, 3:29 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2008, 4:02 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2008, 5:16 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
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.

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2008, 5:15 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
Can this be modified to directly launch a specific menuitem of the context menu.

Similar to SHObjectProperties

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2008, 12:13 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Superfraggle wrote:
Can this be modified to directly launch a specific menuitem of the context menu.

You can use InvokeVerb(Ex) or DoIt for that.
http://msdn.microsoft.com/en-us/library/bb787816.aspx
http://msdn.microsoft.com/en-us/library/bb774170.aspx

There exist examples utilizing them in the forum. You may search.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2008, 12:11 pm 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2009, 2:04 pm 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
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.

Image Image

_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2009, 3:00 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2009, 1:03 am 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
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, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2009, 1:40 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 62 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 25 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group